diff --git a/cmd/climc/shell/compute/cloudaccounts.go b/cmd/climc/shell/compute/cloudaccounts.go index 2cbdb86d33..66d3f736e3 100644 --- a/cmd/climc/shell/compute/cloudaccounts.go +++ b/cmd/climc/shell/compute/cloudaccounts.go @@ -17,7 +17,7 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { diff --git a/cmd/climc/shell/compute/dbinstance_accounts.go b/cmd/climc/shell/compute/dbinstance_accounts.go index 45c8c9b35b..0179c7a1bf 100644 --- a/cmd/climc/shell/compute/dbinstance_accounts.go +++ b/cmd/climc/shell/compute/dbinstance_accounts.go @@ -17,13 +17,14 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { cmd := shell.NewResourceCmd(&modules.DBInstanceAccounts).WithKeyword("dbinstance-account") cmd.List(&options.DBInstanceAccountListOptions{}) - cmd.Update(&options.BaseUpdateOptions{}) + cmd.Update(&baseoptions.BaseUpdateOptions{}) cmd.Show(&options.DBInstanceAccountIdOptions{}) cmd.Delete(&options.DBInstanceAccountIdOptions{}) } diff --git a/cmd/climc/shell/compute/dbinstance_databases.go b/cmd/climc/shell/compute/dbinstance_databases.go index c6703e82f6..2cea215043 100644 --- a/cmd/climc/shell/compute/dbinstance_databases.go +++ b/cmd/climc/shell/compute/dbinstance_databases.go @@ -17,13 +17,14 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { cmd := shell.NewResourceCmd(&modules.DBInstanceDatabases).WithKeyword("dbinstance-database") cmd.List(&options.DBInstanceDatabaseListOptions{}) - cmd.Update(&options.BaseUpdateOptions{}) + cmd.Update(&baseoptions.BaseUpdateOptions{}) cmd.Delete(&options.DBInstanceDatabaseIdOptions{}) cmd.Show(&options.DBInstanceDatabaseIdOptions{}) cmd.Create(&options.DBInstanceDatabaseCreateOptions{}) diff --git a/cmd/climc/shell/compute/dbinstance_skus.go b/cmd/climc/shell/compute/dbinstance_skus.go index f17c02e214..1101648854 100644 --- a/cmd/climc/shell/compute/dbinstance_skus.go +++ b/cmd/climc/shell/compute/dbinstance_skus.go @@ -17,7 +17,7 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { diff --git a/cmd/climc/shell/compute/elasticcache.go b/cmd/climc/shell/compute/elasticcache.go index fc10b35bd5..f06230650c 100644 --- a/cmd/climc/shell/compute/elasticcache.go +++ b/cmd/climc/shell/compute/elasticcache.go @@ -41,7 +41,7 @@ func init() { cmd.PerformWithKeyword("disable-auth", "update-auth-mode", &compute.ElasticCacheDisableAuthOptions{}) type ElasticCacheAccountResetPasswordOptions struct { - options.ElasticCacheIdOptions + compute.ElasticCacheIdOptions PASSWORD string `help:"elastic cache account password."` } @@ -77,7 +77,7 @@ func init() { return nil }) - R(&options.ElasticCacheAccountCreateOptions{}, "elastic-cache-account-create", "Create elastisc cache account", func(s *mcclient.ClientSession, opts *options.ElasticCacheAccountCreateOptions) error { + R(&compute.ElasticCacheAccountCreateOptions{}, "elastic-cache-account-create", "Create elastisc cache account", func(s *mcclient.ClientSession, opts *compute.ElasticCacheAccountCreateOptions) error { params, err := options.ListStructToParams(opts) if err != nil { return err @@ -92,7 +92,7 @@ func init() { return nil }) - R(&options.ElasticCacheIdOptions{}, "elastic-cache-account-delete", "Delete elastisc cache account", func(s *mcclient.ClientSession, opts *options.ElasticCacheIdOptions) error { + R(&compute.ElasticCacheIdOptions{}, "elastic-cache-account-delete", "Delete elastisc cache account", func(s *mcclient.ClientSession, opts *compute.ElasticCacheIdOptions) error { result, err := modules.ElasticCacheAccount.Delete(s, opts.ID, nil) if err != nil { return err @@ -102,7 +102,7 @@ func init() { return nil }) - R(&options.ElasticCacheBackupCreateOptions{}, "elastic-cache-backup-create", "Create elastisc cache backup", func(s *mcclient.ClientSession, opts *options.ElasticCacheBackupCreateOptions) error { + R(&compute.ElasticCacheBackupCreateOptions{}, "elastic-cache-backup-create", "Create elastisc cache backup", func(s *mcclient.ClientSession, opts *compute.ElasticCacheBackupCreateOptions) error { params, err := options.ListStructToParams(opts) if err != nil { return err @@ -132,7 +132,7 @@ func init() { return nil }) - R(&options.ElasticCacheIdOptions{}, "elastic-cache-backup-delete", "Delete elastisc cache backup", func(s *mcclient.ClientSession, opts *options.ElasticCacheIdOptions) error { + R(&compute.ElasticCacheIdOptions{}, "elastic-cache-backup-delete", "Delete elastisc cache backup", func(s *mcclient.ClientSession, opts *compute.ElasticCacheIdOptions) error { result, err := modules.ElasticCacheBackup.Delete(s, opts.ID, nil) if err != nil { return err @@ -142,7 +142,7 @@ func init() { return nil }) - R(&options.ElasticCacheIdOptions{}, "elastic-cache-backup-restore", "Restore elastisc cache backup", func(s *mcclient.ClientSession, opts *options.ElasticCacheIdOptions) error { + R(&compute.ElasticCacheIdOptions{}, "elastic-cache-backup-restore", "Restore elastisc cache backup", func(s *mcclient.ClientSession, opts *compute.ElasticCacheIdOptions) error { result, err := modules.ElasticCacheBackup.PerformAction(s, opts.ID, "restore-instance", nil) if err != nil { return err @@ -152,7 +152,7 @@ func init() { return nil }) - R(&options.ElasticCacheAclCreateOptions{}, "elastic-cache-acl-create", "Create elastisc cache acl", func(s *mcclient.ClientSession, opts *options.ElasticCacheAclCreateOptions) error { + R(&compute.ElasticCacheAclCreateOptions{}, "elastic-cache-acl-create", "Create elastisc cache acl", func(s *mcclient.ClientSession, opts *compute.ElasticCacheAclCreateOptions) error { params, err := options.ListStructToParams(opts) if err != nil { return err @@ -167,7 +167,7 @@ func init() { return nil }) - R(&options.ElasticCacheIdOptions{}, "elastic-cache-acl-delete", "Delete elastisc cache acl", func(s *mcclient.ClientSession, opts *options.ElasticCacheIdOptions) error { + R(&compute.ElasticCacheIdOptions{}, "elastic-cache-acl-delete", "Delete elastisc cache acl", func(s *mcclient.ClientSession, opts *compute.ElasticCacheIdOptions) error { result, err := modules.ElasticCacheAcl.Delete(s, opts.ID, nil) if err != nil { return err @@ -192,7 +192,7 @@ func init() { return nil }) - R(&options.ElasticCacheAclUpdateOptions{}, "elastic-cache-acl-update", "Update elastisc cache acl", func(s *mcclient.ClientSession, opts *options.ElasticCacheAclUpdateOptions) error { + R(&compute.ElasticCacheAclUpdateOptions{}, "elastic-cache-acl-update", "Update elastisc cache acl", func(s *mcclient.ClientSession, opts *compute.ElasticCacheAclUpdateOptions) error { params, err := options.ListStructToParams(opts) if err != nil { return err @@ -223,7 +223,7 @@ func init() { return nil }) - R(&options.ElasticCacheParameterUpdateOptions{}, "elastic-cache-parameter-update", "Update elastisc cache parameter", func(s *mcclient.ClientSession, opts *options.ElasticCacheParameterUpdateOptions) error { + R(&compute.ElasticCacheParameterUpdateOptions{}, "elastic-cache-parameter-update", "Update elastisc cache parameter", func(s *mcclient.ClientSession, opts *compute.ElasticCacheParameterUpdateOptions) error { params, err := options.ListStructToParams(opts) if err != nil { return err @@ -293,7 +293,7 @@ func init() { return nil }) - R(&options.ElasticCacheRemoteUpdateOptions{}, "elastic-cache-remote-update", "Restore elastisc cache backup", func(s *mcclient.ClientSession, opts *options.ElasticCacheRemoteUpdateOptions) error { + R(&compute.ElasticCacheRemoteUpdateOptions{}, "elastic-cache-remote-update", "Restore elastisc cache backup", func(s *mcclient.ClientSession, opts *compute.ElasticCacheRemoteUpdateOptions) error { params, err := options.StructToParams(opts) if err != nil { return err @@ -307,7 +307,7 @@ func init() { return nil }) - R(&options.ElasticCacheAutoRenewOptions{}, "elastic-cache-auto-renew", "Set elastisc cache auto renew", func(s *mcclient.ClientSession, opts *options.ElasticCacheAutoRenewOptions) error { + R(&compute.ElasticCacheAutoRenewOptions{}, "elastic-cache-auto-renew", "Set elastisc cache auto renew", func(s *mcclient.ClientSession, opts *compute.ElasticCacheAutoRenewOptions) error { params, err := options.StructToParams(opts) if err != nil { return err @@ -321,7 +321,7 @@ func init() { return nil }) - R(&options.ElasticCacheRenewOptions{}, "elastic-cache-renew", "Renew elastisc cache", func(s *mcclient.ClientSession, opts *options.ElasticCacheRenewOptions) error { + R(&compute.ElasticCacheRenewOptions{}, "elastic-cache-renew", "Renew elastisc cache", func(s *mcclient.ClientSession, opts *compute.ElasticCacheRenewOptions) error { params, err := options.StructToParams(opts) if err != nil { return err diff --git a/cmd/climc/shell/compute/networkaddresses.go b/cmd/climc/shell/compute/networkaddresses.go index 9d129ee976..99ea3d52aa 100644 --- a/cmd/climc/shell/compute/networkaddresses.go +++ b/cmd/climc/shell/compute/networkaddresses.go @@ -17,7 +17,7 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { diff --git a/cmd/climc/shell/compute/routetable_association.go b/cmd/climc/shell/compute/routetable_association.go index 14f1c61b96..8a95277832 100644 --- a/cmd/climc/shell/compute/routetable_association.go +++ b/cmd/climc/shell/compute/routetable_association.go @@ -17,7 +17,7 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { diff --git a/cmd/climc/shell/compute/routetable_routeset.go b/cmd/climc/shell/compute/routetable_routeset.go index cef300929e..7ea53eebec 100644 --- a/cmd/climc/shell/compute/routetable_routeset.go +++ b/cmd/climc/shell/compute/routetable_routeset.go @@ -17,7 +17,7 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { diff --git a/cmd/climc/shell/compute/routetables.go b/cmd/climc/shell/compute/routetables.go index a108cf4eb0..db9decbeb0 100644 --- a/cmd/climc/shell/compute/routetables.go +++ b/cmd/climc/shell/compute/routetables.go @@ -17,7 +17,7 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { diff --git a/cmd/climc/shell/compute/schedtagresources.go b/cmd/climc/shell/compute/schedtagresources.go index ad0ff76175..84fd63c071 100644 --- a/cmd/climc/shell/compute/schedtagresources.go +++ b/cmd/climc/shell/compute/schedtagresources.go @@ -22,7 +22,7 @@ import ( "yunion.io/x/onecloud/pkg/mcclient" "yunion.io/x/onecloud/pkg/mcclient/modulebase" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) type schedtagModelHelper struct { diff --git a/cmd/climc/shell/compute/schedtags.go b/cmd/climc/shell/compute/schedtags.go index b3a4f3afe5..91abba5f30 100644 --- a/cmd/climc/shell/compute/schedtags.go +++ b/cmd/climc/shell/compute/schedtags.go @@ -17,7 +17,8 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { @@ -29,6 +30,6 @@ func init() { cmd.Create(new(options.SchedtagCreateOptions)) cmd.Update(new(options.SchedtagUpdateOptions)) cmd.BatchPerform("set-scope", new(options.SchedtagSetScopeOptions)) - cmd.PerformWithKeyword("set-user-metadata", "user-metadata", new(options.ResourceMetadataOptions)) + cmd.PerformWithKeyword("set-user-metadata", "user-metadata", new(baseoptions.ResourceMetadataOptions)) cmd.Perform("set-resource", new(options.SchedtagSetResource)) } diff --git a/cmd/climc/shell/compute/secgroups.go b/cmd/climc/shell/compute/secgroups.go index 04e4a4dede..d32b010677 100644 --- a/cmd/climc/shell/compute/secgroups.go +++ b/cmd/climc/shell/compute/secgroups.go @@ -17,7 +17,8 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { @@ -25,7 +26,7 @@ func init() { cmd.List(&options.SecgroupListOptions{}) cmd.Create(&options.SecgroupCreateOptions{}) cmd.Show(&options.SecgroupIdOptions{}) - cmd.Update(&options.BaseUpdateOptions{}) + cmd.Update(&baseoptions.BaseUpdateOptions{}) cmd.Delete(&options.SecgroupIdOptions{}) cmd.Perform("public", &options.SecgroupIdOptions{}) cmd.Perform("syncstatus", &options.SecgroupIdOptions{}) diff --git a/cmd/climc/shell/compute/skus.go b/cmd/climc/shell/compute/skus.go index 990cadf971..081bef9b34 100644 --- a/cmd/climc/shell/compute/skus.go +++ b/cmd/climc/shell/compute/skus.go @@ -17,7 +17,7 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { diff --git a/cmd/climc/shell/compute/vpc_peering_connection.go b/cmd/climc/shell/compute/vpc_peering_connection.go index ee0d608180..06882cfa4a 100644 --- a/cmd/climc/shell/compute/vpc_peering_connection.go +++ b/cmd/climc/shell/compute/vpc_peering_connection.go @@ -17,7 +17,7 @@ package compute import ( "yunion.io/x/onecloud/cmd/climc/shell" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { diff --git a/cmd/climc/shell/compute/vpcs.go b/cmd/climc/shell/compute/vpcs.go index 6d4a1882c3..399be1f98f 100644 --- a/cmd/climc/shell/compute/vpcs.go +++ b/cmd/climc/shell/compute/vpcs.go @@ -18,7 +18,8 @@ import ( "yunion.io/x/onecloud/cmd/climc/shell" "yunion.io/x/onecloud/pkg/mcclient" modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute" - "yunion.io/x/onecloud/pkg/mcclient/options" + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" + options "yunion.io/x/onecloud/pkg/mcclient/options/compute" ) func init() { @@ -33,12 +34,12 @@ func init() { cmd.Perform("sync", &options.VpcIdOptions{}) cmd.Perform("syncstatus", &options.VpcIdOptions{}) cmd.Perform("private", &options.VpcIdOptions{}) - cmd.Perform("public", &options.BasePublicOptions{}) + cmd.Perform("public", &baseoptions.BasePublicOptions{}) cmd.Perform("change-owner", &options.VpcChangeOwnerOptions{}) cmd.Get("vpc-change-owner-candidate-domains", &options.VpcIdOptions{}) cmd.Get("topology", &options.VpcIdOptions{}) - R(&options.ResourceMetadataOptions{}, "vpc-set-user-metadata", "Set metadata of a vpc", func(s *mcclient.ClientSession, opts *options.ResourceMetadataOptions) error { + R(&baseoptions.ResourceMetadataOptions{}, "vpc-set-user-metadata", "Set metadata of a vpc", func(s *mcclient.ClientSession, opts *baseoptions.ResourceMetadataOptions) error { params, err := opts.Params() if err != nil { return err diff --git a/pkg/apis/notify/zz_generated.model.go b/pkg/apis/notify/zz_generated.model.go index 85258af44b..e97ff856a2 100644 --- a/pkg/apis/notify/zz_generated.model.go +++ b/pkg/apis/notify/zz_generated.model.go @@ -125,7 +125,8 @@ type SNotificationLog struct { // SReceiver is an autogenerated struct via yunion.io/x/onecloud/pkg/notify/models.SReceiver. type SReceiver struct { - apis.SEnabledStatusDomainLevelResourceBase + apis.SVirtualResourceBase + apis.SEnabledResourceBase Email string `json:"email"` // swagger:ignore Mobile string `json:"mobile"` diff --git a/pkg/mcclient/options/cloudaccounts.go b/pkg/mcclient/options/compute/cloudaccounts.go similarity index 99% rename from pkg/mcclient/options/cloudaccounts.go rename to pkg/mcclient/options/compute/cloudaccounts.go index b680c5d01e..82137ee31a 100644 --- a/pkg/mcclient/options/cloudaccounts.go +++ b/pkg/mcclient/options/compute/cloudaccounts.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute import ( "fmt" @@ -22,10 +22,11 @@ import ( "yunion.io/x/jsonutils" api "yunion.io/x/onecloud/pkg/apis/compute" + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" ) type CloudaccountListOptions struct { - BaseListOptions + baseoptions.BaseListOptions Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event|tablestore"` ReadOnly *bool `help:"filter read only account" negative:"no-read-only"` @@ -38,7 +39,7 @@ type CloudaccountListOptions struct { } func (opts *CloudaccountListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type SUserPasswordCredential struct { @@ -1152,7 +1153,7 @@ type CloudaccountEnableAutoSyncOptions struct { } func (opts *CloudaccountEnableAutoSyncOptions) Params() (jsonutils.JSONObject, error) { - return StructToParams(opts) + return baseoptions.StructToParams(opts) } type CloudaccountPublicOptions struct { diff --git a/pkg/mcclient/options/dbinstance_account.go b/pkg/mcclient/options/compute/dbinstance_account.go similarity index 85% rename from pkg/mcclient/options/dbinstance_account.go rename to pkg/mcclient/options/compute/dbinstance_account.go index 63bce3aaae..c0faf974df 100644 --- a/pkg/mcclient/options/dbinstance_account.go +++ b/pkg/mcclient/options/compute/dbinstance_account.go @@ -12,17 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute -import "yunion.io/x/jsonutils" +import ( + "yunion.io/x/jsonutils" + + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" +) type DBInstanceAccountListOptions struct { - BaseListOptions + baseoptions.BaseListOptions DBInstance string `help:"ID or Name of DBInstance" json:"dbinstance"` } func (opts *DBInstanceAccountListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type DBInstanceAccountIdOptions struct { diff --git a/pkg/mcclient/options/dbinstance_database.go b/pkg/mcclient/options/compute/dbinstance_database.go similarity index 85% rename from pkg/mcclient/options/dbinstance_database.go rename to pkg/mcclient/options/compute/dbinstance_database.go index 420b8e380b..d251214be5 100644 --- a/pkg/mcclient/options/dbinstance_database.go +++ b/pkg/mcclient/options/compute/dbinstance_database.go @@ -12,17 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute -import "yunion.io/x/jsonutils" +import ( + "yunion.io/x/jsonutils" + + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" +) type DBInstanceDatabaseListOptions struct { - BaseListOptions + baseoptions.BaseListOptions DBInstance string `help:"ID or Name of DBInstance" json:"dbinstance"` } func (opts *DBInstanceDatabaseListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type DBInstanceDatabaseIdOptions struct { @@ -44,5 +48,5 @@ type DBInstanceDatabaseCreateOptions struct { } func (opts *DBInstanceDatabaseCreateOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } diff --git a/pkg/mcclient/options/dbinstance_skus.go b/pkg/mcclient/options/compute/dbinstance_skus.go similarity index 85% rename from pkg/mcclient/options/dbinstance_skus.go rename to pkg/mcclient/options/compute/dbinstance_skus.go index 53f799b1c2..523a7a4ee0 100644 --- a/pkg/mcclient/options/dbinstance_skus.go +++ b/pkg/mcclient/options/compute/dbinstance_skus.go @@ -12,12 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute -import "yunion.io/x/jsonutils" +import ( + "yunion.io/x/jsonutils" + + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" +) type DBInstanceSkuListOption struct { - BaseListOptions + baseoptions.BaseListOptions Engine string EngineVersion string Category string @@ -28,7 +32,7 @@ type DBInstanceSkuListOption struct { } func (opts *DBInstanceSkuListOption) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type DBInstanceSkuIdOption struct { diff --git a/pkg/mcclient/options/elasticcache.go b/pkg/mcclient/options/compute/elasticcache.go similarity index 99% rename from pkg/mcclient/options/elasticcache.go rename to pkg/mcclient/options/compute/elasticcache.go index 9189798b88..6e3e520595 100644 --- a/pkg/mcclient/options/elasticcache.go +++ b/pkg/mcclient/options/compute/elasticcache.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute import ( "yunion.io/x/jsonutils" diff --git a/pkg/mcclient/options/networkaddress.go b/pkg/mcclient/options/compute/networkaddress.go similarity index 92% rename from pkg/mcclient/options/networkaddress.go rename to pkg/mcclient/options/compute/networkaddress.go index 4865abe346..368944b9b8 100644 --- a/pkg/mcclient/options/networkaddress.go +++ b/pkg/mcclient/options/compute/networkaddress.go @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute import ( "yunion.io/x/jsonutils" "yunion.io/x/pkg/errors" + + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" ) type NetworkAddressCreateOptions struct { @@ -39,7 +41,7 @@ func (opts *NetworkAddressCreateOptions) Params() (jsonutils.JSONObject, error) } else { return nil, errors.Error("requires parent spec, try --guest, etc.") } - return StructToParams(opts) + return baseoptions.StructToParams(opts) } func (opts *NetworkAddressCreateOptions) GetCountParam() int { @@ -47,7 +49,7 @@ func (opts *NetworkAddressCreateOptions) GetCountParam() int { } type NetworkAddressListOptions struct { - BaseListOptions + baseoptions.BaseListOptions Type string ParentType string @@ -59,7 +61,7 @@ type NetworkAddressListOptions struct { } func (opts *NetworkAddressListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type NetworkAddressIdOptions struct { diff --git a/pkg/mcclient/options/routetable_association.go b/pkg/mcclient/options/compute/routetable_association.go similarity index 85% rename from pkg/mcclient/options/routetable_association.go rename to pkg/mcclient/options/compute/routetable_association.go index 4dec0ce275..3845d254a8 100644 --- a/pkg/mcclient/options/routetable_association.go +++ b/pkg/mcclient/options/compute/routetable_association.go @@ -12,18 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute -import "yunion.io/x/jsonutils" +import ( + "yunion.io/x/jsonutils" + + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" +) type RouteTableAssociationListOptions struct { - BaseListOptions + baseoptions.BaseListOptions RouteTableId string VpcId string } func (opts *RouteTableAssociationListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type RouteTableAssociationIdOptions struct { diff --git a/pkg/mcclient/options/routetable_routeset.go b/pkg/mcclient/options/compute/routetable_routeset.go similarity index 90% rename from pkg/mcclient/options/routetable_routeset.go rename to pkg/mcclient/options/compute/routetable_routeset.go index 0d8123eca9..a7a8dc51eb 100644 --- a/pkg/mcclient/options/routetable_routeset.go +++ b/pkg/mcclient/options/compute/routetable_routeset.go @@ -12,12 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute -import "yunion.io/x/jsonutils" +import ( + "yunion.io/x/jsonutils" + + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" +) type RouteTableRouteSetListOptions struct { - BaseListOptions + baseoptions.BaseListOptions RouteTableId string VpcId string Type string @@ -27,7 +31,7 @@ type RouteTableRouteSetListOptions struct { } func (opts *RouteTableRouteSetListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type RouteTableRouteSetIdOptions struct { diff --git a/pkg/mcclient/options/routetables.go b/pkg/mcclient/options/compute/routetables.go similarity index 93% rename from pkg/mcclient/options/routetables.go rename to pkg/mcclient/options/compute/routetables.go index 0d1cf2dedf..37c6e6c301 100644 --- a/pkg/mcclient/options/routetables.go +++ b/pkg/mcclient/options/compute/routetables.go @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute import ( "fmt" "yunion.io/x/jsonutils" + + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" ) type Route struct { @@ -63,7 +65,7 @@ type RouteTableCreateOptions struct { } func (opts *RouteTableCreateOptions) Params() (jsonutils.JSONObject, error) { - params, err := optionsStructToParams(opts) + params, err := baseoptions.StructToParams(opts) if err != nil { return nil, err } @@ -103,7 +105,7 @@ func (opts *RouteTableUpdateOptions) GetId() string { } func (opts *RouteTableUpdateOptions) Params() (jsonutils.JSONObject, error) { - params, err := optionsStructToParams(opts) + params, err := baseoptions.StructToParams(opts) if err != nil { return nil, err } @@ -171,11 +173,11 @@ type RouteTableListOptions struct { Vpc string Cloudregion string - BaseListOptions + baseoptions.BaseListOptions } func (opts *RouteTableListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type RouteTableSyncstatusOptions struct { diff --git a/pkg/mcclient/options/schedtags.go b/pkg/mcclient/options/compute/schedtags.go similarity index 97% rename from pkg/mcclient/options/schedtags.go rename to pkg/mcclient/options/compute/schedtags.go index 657e839d77..7bafbaa36b 100644 --- a/pkg/mcclient/options/schedtags.go +++ b/pkg/mcclient/options/compute/schedtags.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute import ( "fmt" @@ -20,10 +20,11 @@ import ( "yunion.io/x/jsonutils" api "yunion.io/x/onecloud/pkg/apis/compute" + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" ) type SchedtagModelListOptions struct { - BaseListOptions + baseoptions.BaseListOptions Schedtag string `help:"ID or Name of schedtag"` } @@ -54,7 +55,7 @@ func (o SchedtagSetOptions) Params() (jsonutils.JSONObject, error) { } type SchedtagListOptions struct { - BaseListOptions + baseoptions.BaseListOptions Type string `help:"Filter by resource type"` CloudproviderId string `help:"Filter by cloudprovider id"` } diff --git a/pkg/mcclient/options/secgroup.go b/pkg/mcclient/options/compute/secgroup.go similarity index 96% rename from pkg/mcclient/options/secgroup.go rename to pkg/mcclient/options/compute/secgroup.go index c856c5e8ec..021798b6c8 100644 --- a/pkg/mcclient/options/secgroup.go +++ b/pkg/mcclient/options/compute/secgroup.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute import ( "fmt" @@ -24,10 +24,11 @@ import ( "yunion.io/x/pkg/util/secrules" "yunion.io/x/onecloud/pkg/apis" + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" ) type SecgroupListOptions struct { - BaseListOptions + baseoptions.BaseListOptions Equals string `help:"Secgroup ID or Name, filter secgroups whose rules equals the specified one"` Server string `help:"Filter secgroups bound to specified server"` @@ -42,11 +43,11 @@ type SecgroupListOptions struct { } func (opts *SecgroupListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type SecgroupCreateOptions struct { - BaseCreateOptions + baseoptions.BaseCreateOptions VpcId string Tags []string Rules []string `help:"security rule to create"` diff --git a/pkg/mcclient/options/serverskus.go b/pkg/mcclient/options/compute/serverskus.go similarity index 94% rename from pkg/mcclient/options/serverskus.go rename to pkg/mcclient/options/compute/serverskus.go index 76fbfad816..82351b9ba2 100644 --- a/pkg/mcclient/options/serverskus.go +++ b/pkg/mcclient/options/compute/serverskus.go @@ -12,12 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute -import "yunion.io/x/jsonutils" +import ( + "yunion.io/x/jsonutils" + + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" +) type ServerSkusListOptions struct { - BaseListOptions + baseoptions.BaseListOptions Cloudregion string `help:"region Id or name"` Usable bool `help:"Filter usable sku"` Zone string `help:"zone Id or name"` @@ -38,7 +42,7 @@ func (opts *ServerSkusListOptions) GetId() string { } func (opts *ServerSkusListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type ServerSkusIdOptions struct { @@ -85,7 +89,7 @@ type ServerSkusCreateOptions struct { } func (opts *ServerSkusCreateOptions) Params() (jsonutils.JSONObject, error) { - return StructToParams(opts) + return baseoptions.StructToParams(opts) } type ServerSkusUpdateOptions struct { @@ -119,5 +123,5 @@ type ServerSkusUpdateOptions struct { } func (opts *ServerSkusUpdateOptions) Params() (jsonutils.JSONObject, error) { - return StructToParams(opts) + return baseoptions.StructToParams(opts) } diff --git a/pkg/mcclient/options/vpc.go b/pkg/mcclient/options/compute/vpc.go similarity index 95% rename from pkg/mcclient/options/vpc.go rename to pkg/mcclient/options/compute/vpc.go index 55187e3e4b..e3f32992e9 100644 --- a/pkg/mcclient/options/vpc.go +++ b/pkg/mcclient/options/compute/vpc.go @@ -12,16 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute import ( "fmt" "yunion.io/x/jsonutils" + + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" ) type VpcListOptions struct { - BaseListOptions + baseoptions.BaseListOptions Usable *bool `help:"Filter usable vpcs"` Region string `help:"ID or Name of region" json:"-"` @@ -41,7 +43,7 @@ func (opts *VpcListOptions) GetContextId() string { } func (opts *VpcListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type VpcCreateOptions struct { @@ -99,8 +101,8 @@ func (opts *VpcIdOptions) Params() (jsonutils.JSONObject, error) { } type VpcUpdateOptions struct { - BaseUpdateOptions - ExternalAccessMode string `help:"Filter by external access mode" choices:"distgw|eip|eip-distgw"` + baseoptions.BaseUpdateOptions + ExternalAccessMode string `help:"Filter by external access mode" choices:"distgw|eip|eip-distgw|none"` Direct bool `help:"Can it be connected directly"` CidrBlock string `help:"IPv4 CIDR block"` diff --git a/pkg/mcclient/options/vpc_peering_connection.go b/pkg/mcclient/options/compute/vpc_peering_connection.go similarity index 84% rename from pkg/mcclient/options/vpc_peering_connection.go rename to pkg/mcclient/options/compute/vpc_peering_connection.go index facd68f0c6..1f273f4c95 100644 --- a/pkg/mcclient/options/vpc_peering_connection.go +++ b/pkg/mcclient/options/compute/vpc_peering_connection.go @@ -12,16 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -package options +package compute -import "yunion.io/x/jsonutils" +import ( + "yunion.io/x/jsonutils" + + baseoptions "yunion.io/x/onecloud/pkg/mcclient/options" +) type VpcPeeringConnectionListOptions struct { - BaseListOptions + baseoptions.BaseListOptions } func (opts *VpcPeeringConnectionListOptions) Params() (jsonutils.JSONObject, error) { - return ListStructToParams(opts) + return baseoptions.ListStructToParams(opts) } type VpcPeeringConnectionIdOptions struct { @@ -37,7 +41,7 @@ func (opts *VpcPeeringConnectionIdOptions) Params() (jsonutils.JSONObject, error } type VpcPeeringConnectionCreateOptions struct { - EnabledStatusCreateOptions + baseoptions.EnabledStatusCreateOptions VpcId string PeerVpcId string Bandwidth int