mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
climc: use BaseListOptions from mcclient/options
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -15,7 +16,7 @@ func init() {
|
||||
* 列出报警日志
|
||||
*/
|
||||
type AlarmLogListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Host string `help:"Name of the host"`
|
||||
Id int64 `help:"ID of tree node"`
|
||||
Label []string `help:"Labels to this tree node"`
|
||||
@@ -26,7 +27,10 @@ func init() {
|
||||
ThisTimeUntil string `help:"This time until the alarm event"`
|
||||
}
|
||||
R(&AlarmLogListOptions{}, "alarmlog-list", "List all alarm's event", func(s *mcclient.ClientSession, args *AlarmLogListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
params, err := args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(args.Host) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Host), "host")
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -116,10 +117,18 @@ func init() {
|
||||
* 列出报警规则
|
||||
*/
|
||||
type AlarmListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&AlarmListOptions{}, "alarm-list", "List all alarms", func(s *mcclient.ClientSession, args *AlarmListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Alarms.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -78,12 +79,20 @@ func init() {
|
||||
* 列出报警模板
|
||||
*/
|
||||
type AlarmTemplateListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
LIST_TYPE string `help:"Type of list: avaliable|applied|created "`
|
||||
LABELS string `help:"Labels for node(split by comma)"`
|
||||
}
|
||||
R(&AlarmTemplateListOptions{}, "alarmtemplate-list", "List all alarm templates ", func(s *mcclient.ClientSession, args *AlarmTemplateListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
params.Add(jsonutils.NewString(args.LIST_TYPE), "type")
|
||||
params.Add(jsonutils.NewString(args.LABELS), "node_labels")
|
||||
|
||||
|
||||
@@ -2,19 +2,27 @@ package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type HostNetworkListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Host string `help:"ID or Name of Host"`
|
||||
Network string `help:"ID or name of network"`
|
||||
}
|
||||
R(&HostNetworkListOptions{}, "host-network-list", "List baremetal network pairs", func(s *mcclient.ClientSession, args *HostNetworkListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Network) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Network), "network_id")
|
||||
}
|
||||
|
||||
@@ -1,17 +1,27 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type BaremetalStorageListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Host string `help:"ID or Name of Host"`
|
||||
}
|
||||
R(&BaremetalStorageListOptions{}, "baremetal-storage-list", "List baremetal storage pairs", func(s *mcclient.ClientSession, args *BaremetalStorageListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
var result *modules.ListResult
|
||||
var err error
|
||||
if len(args.Host) > 0 {
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type CachedImageListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&CachedImageListOptions{}, "cached-image-list", "List cached images", func(s *mcclient.ClientSession, args *CachedImageListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Cachedimages.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -5,15 +5,24 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
type CloudproviderListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&CloudproviderListOptions{}, "cloud-provider-list", "List cloud providers", func(s *mcclient.ClientSession, args *CloudproviderListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Cloudproviders.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -5,18 +5,27 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type CloudregionListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Private bool `help:"show private cloud regions only"`
|
||||
Public bool `help:"show public cloud regions only"`
|
||||
Manager string `help:"Show regions belongs to the cloud provider"`
|
||||
Usable bool `help:"List regions that are usable"`
|
||||
}
|
||||
R(&CloudregionListOptions{}, "cloud-region-list", "List cloud regions", func(s *mcclient.ClientSession, args *CloudregionListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if args.Usable {
|
||||
params.Add(jsonutils.JSONTrue, "usable")
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -11,10 +13,18 @@ func init() {
|
||||
* 获得一个全部通信地址组
|
||||
*/
|
||||
type ContactGroupsListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&ContactGroupsListOptions{}, "contact-group-list", "List all contact groups for all the domainsconta", func(s *mcclient.ClientSession, args *ContactGroupsListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.ContactGroups.List(s, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -70,10 +71,18 @@ func init() {
|
||||
* 获得所有用户的所有通信地址列表
|
||||
*/
|
||||
type ContactsListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&ContactsListOptions{}, "contact-list", "List all contacts for all users", func(s *mcclient.ClientSession, args *ContactsListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.Contacts.List(s, params)
|
||||
if err != nil {
|
||||
@@ -88,11 +97,19 @@ func init() {
|
||||
* 获得一个用户全部通信地址
|
||||
*/
|
||||
type ContactsListForUserOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
UID string `help:"The user you wanna find contact from (Keystone User ID)"`
|
||||
}
|
||||
R(&ContactsListForUserOptions{}, "contact-show", "List all contacts for the users", func(s *mcclient.ClientSession, args *ContactsListForUserOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.Contacts.Get(s, args.UID, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -5,11 +5,12 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type DiskListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Unused bool `help:"Show unused disks"`
|
||||
Share bool `help:"Show Share storage disks"`
|
||||
Local bool `help:"Show Local storage disks"`
|
||||
@@ -17,7 +18,15 @@ func init() {
|
||||
Storage string `help:"Storage ID or name"`
|
||||
}
|
||||
R(&DiskListOptions{}, "disk-list", "List virtual disks", func(s *mcclient.ClientSession, suboptions *DiskListOptions) error {
|
||||
params := FetchPagingParams(suboptions.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = suboptions.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if suboptions.Unused {
|
||||
params.Add(jsonutils.JSONTrue, "unused")
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
type DNSRecordOptions struct {
|
||||
@@ -38,10 +39,18 @@ func parseDNSRecords(args *DNSRecordOptions, params *jsonutils.JSONDict) {
|
||||
|
||||
func init() {
|
||||
type DNSListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&DNSListOptions{}, "dns-list", "List dns records", func(s *mcclient.ClientSession, suboptions *DNSListOptions) error {
|
||||
params := FetchPagingParams(suboptions.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = suboptions.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.DNSRecords.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -4,16 +4,25 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type HostCachedImageListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Host string `help:"ID or Name of Host"`
|
||||
Image string `help:"ID or Name of image"`
|
||||
}
|
||||
R(&HostCachedImageListOptions{}, "host-cachedimage-list", "List host cached image pairs", func(s *mcclient.ClientSession, args *HostCachedImageListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
var result *modules.ListResult
|
||||
var err error
|
||||
if len(args.Host) > 0 {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -26,10 +27,18 @@ func init() {
|
||||
|
||||
Manager string `help:"Show regions belongs to the cloud provider"`
|
||||
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&HostListOptions{}, "host-list", "List hosts", func(s *mcclient.ClientSession, args *HostListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Schedtag) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Schedtag), "schedtag")
|
||||
}
|
||||
|
||||
@@ -4,16 +4,25 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type HostStorageListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Host string `help:"ID or Name of Host"`
|
||||
Storage string `help:"ID or Name of Storage"`
|
||||
}
|
||||
R(&HostStorageListOptions{}, "host-storage-list", "List host storage pairs", func(s *mcclient.ClientSession, args *HostStorageListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
var result *modules.ListResult
|
||||
var err error
|
||||
if len(args.Storage) > 0 {
|
||||
|
||||
@@ -4,16 +4,25 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type HostWireListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Host string `help:"ID or Name of Host"`
|
||||
Wire string `help:"ID or Name of Wire"`
|
||||
}
|
||||
R(&HostWireListOptions{}, "host-wire-list", "List host wire", func(s *mcclient.ClientSession, args *HostWireListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
var result *modules.ListResult
|
||||
var err error
|
||||
if len(args.Host) > 0 {
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type InstanceListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&InstanceListOptions{}, "instance-list", "List instances", func(s *mcclient.ClientSession, suboptions *InstanceListOptions) error {
|
||||
params := FetchPagingParams(suboptions.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = suboptions.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Instances.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -4,17 +4,26 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type DeviceListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Unused bool `help:"Only show unused devices"`
|
||||
Gpu bool `help:"Only show gpu devices"`
|
||||
Host string `help:"Host ID or Name"`
|
||||
}
|
||||
R(&DeviceListOptions{}, "isolated-device-list", "List isolated devices like GPU", func(s *mcclient.ClientSession, args *DeviceListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Host) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Host), "host")
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/sets"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/pkg/util/sets"
|
||||
)
|
||||
|
||||
func initCluster() {
|
||||
@@ -17,11 +17,19 @@ func initCluster() {
|
||||
return resourceCmdN("cluster", suffix)
|
||||
}
|
||||
type listOpt struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&listOpt{}, cmdN("list"), "List k8s clusters", func(s *mcclient.ClientSession, args *listOpt) error {
|
||||
args.Details = true
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
args.Details = options.Bool(true)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := k8s.Clusters.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
@@ -30,8 +29,6 @@ func init() {
|
||||
initService()
|
||||
}
|
||||
|
||||
type BaseListOptions shell.BaseListOptions
|
||||
|
||||
type clusterBaseOptions struct {
|
||||
Cluster string `default:"$K8S_CLUSTER|default" help:"Kubernetes cluster name"`
|
||||
}
|
||||
@@ -99,10 +96,6 @@ var (
|
||||
printBatchResults = printutils.PrintJSONBatchResults
|
||||
)
|
||||
|
||||
func FetchPagingParams(o BaseListOptions) *jsonutils.JSONDict {
|
||||
return shell.FetchPagingParams(shell.BaseListOptions(o))
|
||||
}
|
||||
|
||||
func resourceCmdN(prefix, suffix string) string {
|
||||
return fmt.Sprintf("k8s-%s-%s", prefix, suffix)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func initNode() {
|
||||
@@ -14,14 +15,19 @@ func initNode() {
|
||||
return resourceCmdN("node", suffix)
|
||||
}
|
||||
type listOpt struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Cluster string `help:"Filter by cluster"`
|
||||
}
|
||||
R(&listOpt{}, cmdN("list"), "List k8s node", func(s *mcclient.ClientSession, args *listOpt) error {
|
||||
args.Details = true
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
if args.Cluster != "" {
|
||||
params.Add(jsonutils.NewString(args.Cluster), "cluster")
|
||||
args.Details = options.Bool(true)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = options.ListStructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := k8s.Nodes.List(s, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func initRepo() {
|
||||
@@ -12,10 +13,18 @@ func initRepo() {
|
||||
return resourceCmdN("repo", suffix)
|
||||
}
|
||||
type listOpt struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&listOpt{}, cmdN("list"), "List k8s global helm repos", func(s *mcclient.ClientSession, args *listOpt) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := k8s.Repos.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -7,15 +7,24 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type KeypairList struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
|
||||
R(&KeypairList{}, "keypair-list", "List keypairs.", func(s *mcclient.ClientSession, args *KeypairList) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.Keypairs.List(s, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -81,10 +82,18 @@ func init() {
|
||||
* 列出所有的标签
|
||||
*/
|
||||
type LabelListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&LabelListOptions{}, "label-list", "List labels", func(s *mcclient.ClientSession, args *LabelListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Labels.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -26,10 +28,18 @@ func init() {
|
||||
* 列出所有监控指标
|
||||
*/
|
||||
type MetricsListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&MetricsListOptions{}, "metric-list", "List all metrics", func(s *mcclient.ClientSession, args *MetricsListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.Metrics.List(s, params)
|
||||
if err != nil {
|
||||
@@ -44,11 +54,19 @@ func init() {
|
||||
* 查看监控指标详情
|
||||
*/
|
||||
type MetricsShowOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
ID string `help:"The ID of the metric"`
|
||||
}
|
||||
R(&MetricsShowOptions{}, "metric-show", "Show metric details", func(s *mcclient.ClientSession, args *MetricsShowOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.Metrics.Get(s, args.ID, params)
|
||||
if err != nil {
|
||||
@@ -63,11 +81,19 @@ func init() {
|
||||
* 根据name查看监控指标详情
|
||||
*/
|
||||
type MetricsShowByNameOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
NAME string `help:"The NAME of the metric"`
|
||||
}
|
||||
R(&MetricsShowByNameOptions{}, "metric-details", "Show metric details by name", func(s *mcclient.ClientSession, args *MetricsShowByNameOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.Metrics.GetSpecific(s, "", args.NAME, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -11,10 +13,18 @@ func init() {
|
||||
* 列出全部的监控类型
|
||||
*/
|
||||
type MonitorTypesOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&MonitorTypesOptions{}, "monitortype-list", "List all monitor types", func(s *mcclient.ClientSession, args *MonitorTypesOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.MonitorTypes.List(s, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -11,10 +13,18 @@ func init() {
|
||||
* 列出所有监控数据源
|
||||
*/
|
||||
type MonitorInputsListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&MonitorInputsListOptions{}, "monitorinputs-list", "List all monitor-inputs", func(s *mcclient.ClientSession, args *MonitorInputsListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.MonitorInputs.List(s, params)
|
||||
if err != nil {
|
||||
@@ -29,11 +39,19 @@ func init() {
|
||||
* 查看监控数据源下的监控项
|
||||
*/
|
||||
type MonitorInputsShowOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
ID string `help:"The ID of the monitor-input"`
|
||||
}
|
||||
R(&MonitorInputsShowOptions{}, "monitorinputs-metrics-list", "List all metrics for the monitor-inputs", func(s *mcclient.ClientSession, args *MonitorInputsShowOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.MonitorInputs.GetSpecific(s, args.ID, "metrics", params)
|
||||
if err != nil {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -47,10 +48,18 @@ func init() {
|
||||
* 列出监控模板
|
||||
*/
|
||||
type MonitorTemplateListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&MonitorTemplateListOptions{}, "monitortemplate-list", "List all monitor-template", func(s *mcclient.ClientSession, args *MonitorTemplateListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.MonitorTemplates.List(s, params)
|
||||
if err != nil {
|
||||
@@ -65,11 +74,19 @@ func init() {
|
||||
* 查看监控模板详情
|
||||
*/
|
||||
type MonitorTemplateShowOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
ID string `help:"The ID of the monitor-template"`
|
||||
}
|
||||
R(&MonitorTemplateShowOptions{}, "monitortemplate-show", "Show monitor-template", func(s *mcclient.ClientSession, args *MonitorTemplateShowOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.MonitorTemplates.Get(s, args.ID, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -6,18 +6,27 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type NetworkListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Ip string `help:"search networks that contain this IP"`
|
||||
Zone string `help:"search networks in a zone"`
|
||||
Wire string `help:"search networks belongs to a wire"`
|
||||
Vpc string `help:"search networks belongs to a VPC"`
|
||||
}
|
||||
R(&NetworkListOptions{}, "network-list", "List networks", func(s *mcclient.ClientSession, args *NetworkListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Ip) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Ip), "ip")
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -14,11 +15,19 @@ func init() {
|
||||
* 查看所有的监控节点 | 列出匹配标签的节点列表
|
||||
*/
|
||||
type NodeListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Labels []string `help:"Node labels"`
|
||||
}
|
||||
R(&NodeListOptions{}, "node-list", "List all nodes", func(s *mcclient.ClientSession, args *NodeListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Labels) > 0 {
|
||||
for _, f := range args.Labels {
|
||||
parts := strings.Split(f, "=")
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -71,7 +72,7 @@ func init() {
|
||||
* 查询已发送的通知任务
|
||||
*/
|
||||
type NotificationListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&NotificationListOptions{}, "notify-list", "List notification history", func(s *mcclient.ClientSession, args *NotificationListOptions) error {
|
||||
result, err := modules.Notifications.List(s, nil)
|
||||
|
||||
@@ -4,14 +4,23 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type OperationListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&OperationListOptions{}, "operation-list", "List operations", func(s *mcclient.ClientSession, suboptions *OperationListOptions) error {
|
||||
params := FetchPagingParams(suboptions.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = suboptions.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Operations.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type TaskListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&TaskListOptions{}, "process-list", "List processes", func(s *mcclient.ClientSession, suboptions *TaskListOptions) error {
|
||||
params := FetchPagingParams(suboptions.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = suboptions.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Processes.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type TaskListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&TaskListOptions{}, "prosesslog-list", "List processlogs", func(s *mcclient.ClientSession, suboptions *TaskListOptions) error {
|
||||
params := FetchPagingParams(suboptions.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = suboptions.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Processlogs.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -11,10 +13,18 @@ func init() {
|
||||
* 列出所有监控指标
|
||||
*/
|
||||
type ProjectAdminListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&ProjectAdminListOptions{}, "projectadmin-list", "List all Project Admins", func(s *mcclient.ClientSession, args *ProjectAdminListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.ProjectAdmin.List(s, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -11,10 +13,18 @@ func init() {
|
||||
* 列出所有监控指标
|
||||
*/
|
||||
type ProjectAdminCandidateListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&ProjectAdminCandidateListOptions{}, "projectadmincandidate-list", "List all Project Admin Candidates", func(s *mcclient.ClientSession, args *ProjectAdminCandidateListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.ProjectAdminCandidate.List(s, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -11,14 +12,22 @@ func init() {
|
||||
* 列出列表
|
||||
*/
|
||||
type RateListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
RESTYPE string `"help":"res_type of the rate"`
|
||||
ACTION string `"help":"action of list :querygroup or queryhistory"`
|
||||
SubResType string `"help":"query the subResType"`
|
||||
Id string `"help":"ID of rate"`
|
||||
}
|
||||
R(&RateListOptions{}, "rate-list", "List all rates ", func(s *mcclient.ClientSession, args *RateListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
params.Add(jsonutils.NewString(args.RESTYPE), "res_type")
|
||||
params.Add(jsonutils.NewString(args.ACTION), "action")
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -74,12 +75,20 @@ func init() {
|
||||
* 查询树节点的报警接收人信息
|
||||
*/
|
||||
type TreeNodeRecipientsListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
LIST_TYPE string `help:"Type of list: junior|senior"`
|
||||
LABELS string `help:"Labels for tree-node(split by comma)"`
|
||||
}
|
||||
R(&TreeNodeRecipientsListOptions{}, "treenode-recipient-list", "List recipient for the tree-node ", func(s *mcclient.ClientSession, args *TreeNodeRecipientsListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
params.Add(jsonutils.NewString(args.LIST_TYPE), "type")
|
||||
params.Add(jsonutils.NewString(args.LABELS), "node_labels")
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -40,11 +41,19 @@ func init() {
|
||||
})
|
||||
|
||||
type ReservedIPListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Network string `help:"Network filter"`
|
||||
}
|
||||
R(&ReservedIPListOptions{}, "reserved-ip-list", "Show all reserved IPs for any network", func(s *mcclient.ClientSession, args *ReservedIPListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Network) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Network), "network")
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -11,12 +12,20 @@ func init() {
|
||||
* 列出列表
|
||||
*/
|
||||
type ResourceDetailListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
QUERYTYPE string `"help":"query type of the resource_detail"`
|
||||
ProjectId string `"help":"project id of the resource_detail"`
|
||||
}
|
||||
R(&ResourceDetailListOptions{}, "resourcedetail-list", "List all resource details", func(s *mcclient.ClientSession, args *ResourceDetailListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.QUERYTYPE) > 0 {
|
||||
params.Add(jsonutils.NewString(args.QUERYTYPE), "query_type")
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -11,7 +12,7 @@ func init() {
|
||||
* 列出列表
|
||||
*/
|
||||
type ResourceFeeListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
STATTYPE string `"help":"stat type of the resource_fee"`
|
||||
STATMONTH string `"help":"stat month of the resource_fee"`
|
||||
ProjectId string `"help":"project id of the resource_fee"`
|
||||
@@ -19,7 +20,15 @@ func init() {
|
||||
EndDay string `"help":"end day of the resource_fee"`
|
||||
}
|
||||
R(&ResourceFeeListOptions{}, "resourcefee-list", "List all resource fees", func(s *mcclient.ClientSession, args *ResourceFeeListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.STATTYPE) > 0 {
|
||||
params.Add(jsonutils.NewString(args.STATTYPE), "stat_type")
|
||||
}
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type SchedtagHostListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Schedtag string `help:"ID or Name of schedtag"`
|
||||
}
|
||||
R(&SchedtagHostListOptions{}, "schedtag-host-list", "List all scheduler tag and host pairs", func(s *mcclient.ClientSession, args *SchedtagHostListOptions) error {
|
||||
@@ -15,7 +17,15 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
var result *modules.ListResult
|
||||
if len(args.Schedtag) > 0 {
|
||||
result, err = mod.ListDescendent(s, args.Schedtag, params)
|
||||
|
||||
@@ -5,14 +5,23 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type SchedtagListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&SchedtagListOptions{}, "schedtag-list", "List schedule tags", func(s *mcclient.ClientSession, suboptions *SchedtagListOptions) error {
|
||||
params := FetchPagingParams(suboptions.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = suboptions.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Schedtags.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -4,11 +4,12 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type SecGroupRulesListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Secgroup string `help:"Secgroup ID or Name"`
|
||||
Direction string `help:"filter Direction of rule" choices:"in|out"`
|
||||
Protocol string `help:"filter Protocol of rule" choices:"any|tcp|udp|icmp"`
|
||||
@@ -16,7 +17,15 @@ func init() {
|
||||
}
|
||||
|
||||
R(&SecGroupRulesListOptions{}, "secgroup-rule-list", "List all security group", func(s *mcclient.ClientSession, args *SecGroupRulesListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Secgroup) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Secgroup), "secgroup")
|
||||
}
|
||||
|
||||
@@ -6,15 +6,24 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type SecGroupsListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
|
||||
R(&SecGroupsListOptions{}, "secgroup-list", "List all security group", func(s *mcclient.ClientSession, args *SecGroupsListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.SecGroups.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -5,15 +5,24 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type ServerDiskListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Server string `help:"ID or Name of Server"`
|
||||
}
|
||||
R(&ServerDiskListOptions{}, "server-disk-list", "List server disk pairs", func(s *mcclient.ClientSession, args *ServerDiskListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
var result *modules.ListResult
|
||||
var err error
|
||||
if len(args.Server) > 0 {
|
||||
|
||||
@@ -4,18 +4,27 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type ServerNetworkListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Server string `help:"ID or Name of Server"`
|
||||
Mac string `help:"search the MAC address"`
|
||||
Ip string `help:"search the IP address"`
|
||||
Network string `help:"Network ID or name"`
|
||||
}
|
||||
R(&ServerNetworkListOptions{}, "server-network-list", "List server network pairs", func(s *mcclient.ClientSession, args *ServerNetworkListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Mac) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Mac), "mac_addr")
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -72,11 +73,19 @@ func init() {
|
||||
* 查看指定服务树节点的机器
|
||||
*/
|
||||
type ServiceHostListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Labels string `help:"Labels for tree-node(split by comma)"`
|
||||
}
|
||||
R(&ServiceHostListOptions{}, "servicehost-list", "List all hosts for the tree-node", func(s *mcclient.ClientSession, args *ServiceHostListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Labels) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Labels), "node_labels")
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -11,10 +13,18 @@ func init() {
|
||||
* 列出所有监控指标
|
||||
*/
|
||||
type ServiceNameSuggestionListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&ServiceNameSuggestionListOptions{}, "servicenamesuggestion-list", "List all serviceNameSuggestion", func(s *mcclient.ClientSession, args *ServiceNameSuggestionListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
result, err := modules.ServiceNameSuggestion.List(s, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -79,10 +80,18 @@ func init() {
|
||||
* 列出服务树
|
||||
*/
|
||||
type ServiceTreeListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&ServiceTreeListOptions{}, "servicetree-list", "List all service tree", func(s *mcclient.ClientSession, args *ServiceTreeListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.ServiceTrees.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -2,8 +2,6 @@ package shell
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
)
|
||||
|
||||
type CMD struct {
|
||||
@@ -19,105 +17,6 @@ func R(options interface{}, command string, desc string, callback interface{}) {
|
||||
CommandTable = append(CommandTable, CMD{options, command, desc, callback})
|
||||
}
|
||||
|
||||
type BaseListOptions struct {
|
||||
Limit int `default:"20" help:"Page limit"`
|
||||
Offset int `default:"0" help:"Page offset"`
|
||||
OrderBy string `help:"Name of the field to be ordered by"`
|
||||
Order string `help:"List order" choices:"desc|asc"`
|
||||
Details bool `help:"Show more details"`
|
||||
Search string `help:"Filter results by a simple keyword search"`
|
||||
Meta bool `help:"Piggyback metadata information"`
|
||||
Filter []string `help:"Filters"`
|
||||
JointFilter []string `help:"Filters with joint table col; joint_tbl(related_key).filter_col.filter_cond(filters)"`
|
||||
FilterAny bool `help:"If true, match if any of the filters matches; otherwise, match if all of the filters match"`
|
||||
Admin bool `help:"Is an admin call?"`
|
||||
Tenant string `help:"Tenant ID or Name"`
|
||||
User string `help:"User ID or Name"`
|
||||
System bool `help:"Show system resource"`
|
||||
PendingDelete bool `help:"Show pending deleted resource"`
|
||||
Field []string `help:"Show only specified fields"`
|
||||
ShowEmulated bool `help:"Show all resources including the emulated resources"`
|
||||
}
|
||||
|
||||
func FetchPagingParams(options BaseListOptions) *jsonutils.JSONDict {
|
||||
params := jsonutils.NewDict()
|
||||
if options.Limit > 0 {
|
||||
params.Add(jsonutils.NewInt(int64(options.Limit)), "limit")
|
||||
}
|
||||
if options.Offset > 0 {
|
||||
params.Add(jsonutils.NewInt(int64(options.Offset)), "offset")
|
||||
}
|
||||
if len(options.OrderBy) > 0 {
|
||||
params.Add(jsonutils.NewString(options.OrderBy), "order_by")
|
||||
}
|
||||
if len(options.Order) > 0 {
|
||||
params.Add(jsonutils.NewString(options.Order), "order")
|
||||
}
|
||||
if options.Details {
|
||||
params.Add(jsonutils.JSONTrue, "details")
|
||||
} else {
|
||||
params.Add(jsonutils.JSONFalse, "details")
|
||||
}
|
||||
if len(options.Search) > 0 {
|
||||
params.Add(jsonutils.NewString(options.Search), "search")
|
||||
}
|
||||
if options.Meta {
|
||||
params.Add(jsonutils.JSONTrue, "with_meta")
|
||||
}
|
||||
if len(options.JointFilter) > 0 {
|
||||
arr := jsonutils.NewArray()
|
||||
for _, f := range options.JointFilter {
|
||||
arr.Add(jsonutils.NewString(f))
|
||||
}
|
||||
params.Add(arr, "joint_filter")
|
||||
}
|
||||
if len(options.Filter) > 0 {
|
||||
arr := jsonutils.NewArray()
|
||||
for _, f := range options.Filter {
|
||||
arr.Add(jsonutils.NewString(f))
|
||||
}
|
||||
params.Add(arr, "filter")
|
||||
if options.FilterAny {
|
||||
params.Add(jsonutils.JSONTrue, "filter_any")
|
||||
}
|
||||
}
|
||||
if options.Admin {
|
||||
params.Add(jsonutils.JSONTrue, "admin")
|
||||
}
|
||||
if len(options.Tenant) > 0 {
|
||||
params.Add(jsonutils.NewString(options.Tenant), "tenant")
|
||||
if !options.Admin {
|
||||
params.Add(jsonutils.JSONTrue, "admin")
|
||||
}
|
||||
}
|
||||
if len(options.User) > 0 {
|
||||
params.Add(jsonutils.NewString(options.User), "user")
|
||||
}
|
||||
if options.System {
|
||||
params.Add(jsonutils.JSONTrue, "system")
|
||||
if !options.Admin {
|
||||
params.Add(jsonutils.JSONTrue, "admin")
|
||||
}
|
||||
}
|
||||
if options.PendingDelete {
|
||||
params.Add(jsonutils.JSONTrue, "pending_delete")
|
||||
if !options.Admin {
|
||||
params.Add(jsonutils.JSONTrue, "admin")
|
||||
}
|
||||
}
|
||||
if len(options.Field) > 0 {
|
||||
arr := jsonutils.NewArray()
|
||||
for _, f := range options.Field {
|
||||
arr.Add(jsonutils.NewString(f))
|
||||
}
|
||||
params.Add(arr, "field")
|
||||
}
|
||||
if options.ShowEmulated {
|
||||
params.Add(jsonutils.JSONTrue, "show_emulated")
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func InvalidUpdateError() error {
|
||||
return fmt.Errorf("No valid update data")
|
||||
}
|
||||
|
||||
@@ -6,17 +6,26 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type ListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Model string `help:"Specified model specs" choices:"hosts|isolated_devices|guests"`
|
||||
HostType string `help:"Host type filter" choices:"baremetal|hypervisor|esxi|kubelet|hyperv"`
|
||||
Gpu bool `help:"Only show gpu devices"`
|
||||
}
|
||||
R(&ListOptions{}, "spec", "List all kinds of model specs", func(s *mcclient.ClientSession, args *ListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
model := ""
|
||||
if len(args.Model) != 0 {
|
||||
model = args.Model
|
||||
@@ -36,7 +45,7 @@ func init() {
|
||||
})
|
||||
|
||||
type HostsQueryOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
HostType string `help:"Host type filter" choices:"baremetal|hypervisor|esxi|kubelet|hyperv"`
|
||||
Ncpu int64 `help:"#CPU count of host" metavar:"<CPU_COUNT>"`
|
||||
MemSize string `help:"Memory GB size"`
|
||||
@@ -61,7 +70,15 @@ func init() {
|
||||
}
|
||||
return keys
|
||||
}
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.HostType) > 0 {
|
||||
params.Add(jsonutils.NewString(args.HostType), "host_type")
|
||||
}
|
||||
@@ -80,7 +97,7 @@ func init() {
|
||||
})
|
||||
|
||||
type IsoDevQueryOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Model string `help:"Device model name"`
|
||||
Vendor string `help:"Device vendor name"`
|
||||
}
|
||||
@@ -95,7 +112,15 @@ func init() {
|
||||
}
|
||||
return keys
|
||||
}
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
resp, err := modules.Specs.SpecsQueryModelObjects(s, "isolated_devices", newSpecKeys(), params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -4,16 +4,25 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type StorageCachedImageListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Storagecache string `help:"ID or Name of Storage"`
|
||||
Image string `help:"ID or Name of image"`
|
||||
}
|
||||
R(&StorageCachedImageListOptions{}, "storage-cached-image-list", "List storage cached image pairs", func(s *mcclient.ClientSession, args *StorageCachedImageListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
var result *modules.ListResult
|
||||
var err error
|
||||
if len(args.Storagecache) > 0 {
|
||||
|
||||
@@ -4,16 +4,25 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type StoragecacheListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
|
||||
Manager string `help:"Show regions belongs to the cloud provider"`
|
||||
}
|
||||
R(&StoragecacheListOptions{}, "storage-cache-list", "List storage caches", func(s *mcclient.ClientSession, args *StoragecacheListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if len(args.Manager) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Manager), "manager")
|
||||
|
||||
@@ -6,11 +6,12 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type StorageListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Share bool `help:"Share storage list"`
|
||||
Local bool `help:"Local storage list"`
|
||||
Usable bool `help:"Usable storage list"`
|
||||
@@ -20,7 +21,15 @@ func init() {
|
||||
Manager string `help:"Show regions belongs to the cloud provider"`
|
||||
}
|
||||
R(&StorageListOptions{}, "storage-list", "List storages", func(s *mcclient.ClientSession, args *StorageListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if args.Share {
|
||||
params.Add(jsonutils.JSONTrue, "share")
|
||||
}
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type TaskListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&TaskListOptions{}, "task-list", "List taskman", func(s *mcclient.ClientSession, suboptions *TaskListOptions) error {
|
||||
params := FetchPagingParams(suboptions.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = suboptions.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Tasks.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -20,7 +30,15 @@ func init() {
|
||||
})
|
||||
|
||||
R(&TaskListOptions{}, "region-task-list", "List tasks on region server", func(s *mcclient.ClientSession, suboptions *TaskListOptions) error {
|
||||
params := FetchPagingParams(suboptions.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = suboptions.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.ComputeTasks.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -58,12 +59,20 @@ func init() {
|
||||
})
|
||||
|
||||
type ServiceTreeNodeListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Label string `help:"Label of node"`
|
||||
Pid int64 `help:"Pid of node" default:"-1"`
|
||||
}
|
||||
R(&ServiceTreeNodeListOptions{}, "servicetree-node-list", "List servicetree nodes", func(s *mcclient.ClientSession, args *ServiceTreeNodeListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if args.Pid >= 0 {
|
||||
params.Add(jsonutils.NewInt(args.Pid), "pid")
|
||||
}
|
||||
|
||||
@@ -4,14 +4,23 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type VCenterListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&VCenterListOptions{}, "vcenter-list", "List VMWare vcenters", func(s *mcclient.ClientSession, args *VCenterListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.VCenters.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+11
-2
@@ -4,16 +4,25 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type VpcListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Region string `help:"ID or Name of region"`
|
||||
Manager string `help:"Show regions belongs to the cloud provider"`
|
||||
}
|
||||
R(&VpcListOptions{}, "vpc-list", "List VPCs", func(s *mcclient.ClientSession, args *VpcListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if len(args.Manager) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Manager), "manager")
|
||||
|
||||
@@ -4,16 +4,25 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type WireListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Zone string `help:"list wires in zone"`
|
||||
Vpc string `help:"List wires in vpc"`
|
||||
}
|
||||
R(&WireListOptions{}, "wire-list", "List wires", func(s *mcclient.ClientSession, args *WireListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Vpc) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Vpc), "vpc")
|
||||
}
|
||||
|
||||
@@ -4,18 +4,27 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type ZoneListOptions struct {
|
||||
BaseListOptions
|
||||
options.BaseListOptions
|
||||
Region string `help:"cloud region ID or Name"`
|
||||
Usable bool `help:"List all zones that is usable"`
|
||||
Private bool `help:"show all zones in private cloud regions only"`
|
||||
Public bool `help:"show all zones in public cloud regions only"`
|
||||
}
|
||||
R(&ZoneListOptions{}, "zone-list", "List zones", func(s *mcclient.ClientSession, args *ZoneListOptions) error {
|
||||
params := FetchPagingParams(args.BaseListOptions)
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if args.Usable {
|
||||
params.Add(jsonutils.JSONTrue, "usable")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user