mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-30 18:23:35 +08:00
fix: add climc support vpc/schedtag user metadata
This commit is contained in:
@@ -153,4 +153,17 @@ func init() {
|
||||
printBatchResults(ret, modules.Schedtags.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ResourceMetadataOptions{}, "schedtag-set-user-metadata", "Set metadata of a server", func(s *mcclient.ClientSession, opts *options.ResourceMetadataOptions) error {
|
||||
params, err := opts.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := modules.Schedtags.PerformAction(s, opts.ID, "user-metadata", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -35,4 +36,17 @@ func init() {
|
||||
cmd.Perform("public", &options.BasePublicOptions{})
|
||||
cmd.Perform("change-owner", &options.VpcChangeOwnerOptions{})
|
||||
cmd.Get("vpc-change-owner-candidate-domains", &options.VpcIdOptions{})
|
||||
|
||||
R(&options.ResourceMetadataOptions{}, "vpc-set-user-metadata", "Set metadata of a vpc", func(s *mcclient.ClientSession, opts *options.ResourceMetadataOptions) error {
|
||||
params, err := opts.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := modules.Vpcs.PerformAction(s, opts.ID, "user-metadata", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func (this *SchedtagManager) DoBatchSchedtagHostAddRemove(s *mcclient.ClientSess
|
||||
|
||||
func init() {
|
||||
Schedtags = SchedtagManager{NewComputeManager("schedtag", "schedtags",
|
||||
[]string{"ID", "Name", "Default_strategy", "Resource_type", "Domain_id", "Project_id"},
|
||||
[]string{"ID", "Name", "Default_strategy", "Resource_type", "Domain_id", "Project_id", "Metadata"},
|
||||
[]string{})}
|
||||
|
||||
registerCompute(&Schedtags)
|
||||
|
||||
@@ -22,7 +22,7 @@ var (
|
||||
|
||||
func init() {
|
||||
Vpcs = NewComputeManager("vpc", "vpcs",
|
||||
[]string{"ID", "Name", "Enabled", "Status", "Cloudregion_Id", "Is_default", "Cidr_Block", "Region", "Public_Scope", "Domain_Id", "Domain"},
|
||||
[]string{"ID", "Name", "Enabled", "Status", "Cloudregion_Id", "Is_default", "Cidr_Block", "Region", "Public_Scope", "Domain_Id", "Domain", "Metadata"},
|
||||
[]string{})
|
||||
|
||||
registerCompute(&Vpcs)
|
||||
|
||||
Reference in New Issue
Block a user