feat(climc): server-list --os-arch (#14465)

This commit is contained in:
Zexi Li
2022-06-15 04:46:23 +08:00
committed by GitHub
parent f1e616a671
commit 0c2762da7f
2 changed files with 19 additions and 8 deletions
+18 -8
View File
@@ -174,15 +174,17 @@ func ListStructToParams(v interface{}) (*jsonutils.JSONDict, error) {
return nil, err
}
{
f := rv.FieldByName("BaseListOptions")
if f.IsValid() {
listOpts, ok := f.Addr().Interface().(*BaseListOptions)
if ok {
listParams, err := listOpts.Params()
if err != nil {
return nil, err
for _, oName := range []string{"BaseListOptions", "MultiArchListOptions"} {
f := rv.FieldByName(oName)
if f.IsValid() {
listOpts, ok := f.Addr().Interface().(IParamsOptions)
if ok {
listParams, err := listOpts.Params()
if err != nil {
return nil, err
}
params.Update(listParams)
}
params.Update(listParams)
}
}
}
@@ -422,6 +424,14 @@ func (o *ScopedResourceListOptions) Params() (*jsonutils.JSONDict, error) {
return optionsStructToParams(o)
}
type MultiArchListOptions struct {
OsArch string `help:"Filter resource by arch" choices:"i386|x86|x86_32|x86_64|arm|aarch32|aarch64"`
}
func (o *MultiArchListOptions) Params() (*jsonutils.JSONDict, error) {
return optionsStructToParams(o)
}
type BaseUpdateOptions struct {
ID string `help:"ID or Name of resource to update"`
Name string `help:"Name of resource to update"`
+1
View File
@@ -68,6 +68,7 @@ type ServerListOptions struct {
ScalingGroup string `help:"ScalingGroup's id or name'"`
options.BaseListOptions
options.MultiArchListOptions
VpcProvider string `help:"filter by vpc's provider" json:"vpc_provider"`