fix: deprecated-by => yunion:deprecated-by

This commit is contained in:
Qiu Jian
2020-04-15 22:51:57 +08:00
parent 5651805eb0
commit 98fcd1df0f
46 changed files with 162 additions and 103 deletions

2
go.mod
View File

@@ -130,7 +130,7 @@ require (
yunion.io/x/executor v0.0.0-20200227030256-a18417815e74
yunion.io/x/jsonutils v0.0.0-20200415132054-2bf8a5e94501
yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3
yunion.io/x/pkg v0.0.0-20200415124010-2c7da30b998f
yunion.io/x/pkg v0.0.0-20200416145704-22c189971435
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57
yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3

4
go.sum
View File

@@ -1116,8 +1116,8 @@ yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3/go.mod h1:LC6f/4FozL0iaAbnFt2
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20200415124010-2c7da30b998f h1:7aKKuquYIFESmLnti3ea0IhGMZ1K1JnP/1XeJg59bmA=
yunion.io/x/pkg v0.0.0-20200415124010-2c7da30b998f/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20200416145704-22c189971435 h1:Fwf1rjdl+Qmw9BNxQN7wi2lQpYVExV7eBLifd0emHaI=
yunion.io/x/pkg v0.0.0-20200416145704-22c189971435/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57 h1:KtQAuLJ00RSUVqkiRmJ1DiDABiw0U3xxXnzD3lGavaY=

View File

@@ -53,7 +53,11 @@ func (ps *SProxySetting) IsZero() bool {
type ProxySettingResourceInput struct {
// 代理配置
ProxySettingId string `json:"proxy_setting_id"`
ProxySetting string `json:"proxy_setting"`
// swagger:ignore
// Deprecated
// ProxySettingId string `json:"proxy_setting_id" "yunion:deprecated-by":"proxy_setting"`
}
type ProxySettingTestInput struct {

View File

@@ -285,7 +285,7 @@ type ServerConfigs struct {
// swagger:ignore
// Deprecated
// alias for InstanceType
Sku string `json:"sku" deprecated-by:"instance_type"`
Sku string `json:"sku" "yunion:deprecated-by":"instance_type"`
// 虚拟机高可用(创建备机)
// default: false
@@ -358,11 +358,12 @@ type ServerCreateInput struct {
UserData string `json:"user_data"`
// swagger:ignore
Keypair string `json:"keypair" deprecated-by:"keypair_id"`
// Deprecated
KeypairId string `json:"keypair_id" "yunion:deprecated-by":"keypair"`
// 秘钥对Id
// required: false
KeypairId string `json:"keypair_id"`
Keypair string `json:"keypair"`
// 密码
// 要求: 密码长度 >= 20, 至少包含一个数字一个小写字母一个大小字母及特殊字符~`!@#$%^&*()-_=+[]{}|:';\",./<>?中的一个

View File

@@ -43,7 +43,7 @@ type LoadbalancerCertificateResourceInput struct {
// swagger:ignore
// Deprecated
CertificateId string `json:"certificate_id" deprecated-by:"certificate"`
CertificateId string `json:"certificate_id" "yunion:deprecated-by":"certificate"`
}
type LoadbalancerCertificateFilterListInput struct {

View File

@@ -66,7 +66,7 @@ type CloudenvResourceListInput struct {
Providers []string `json:"providers"`
// swagger:ignore
// Deprecated
Provider []string `json:"provider" deprecated-by:"providers"`
Provider []string `json:"provider" "yunion:deprecated-by":"providers"`
// 列出指定云平台品牌的资源一般来说brand和provider相同除了以上支持的provider之外还支持以下band
//
@@ -77,7 +77,7 @@ type CloudenvResourceListInput struct {
Brands []string `json:"brands"`
// swagger:ignore
// Deprecated
Brand []string `json:"brand" deprecated-by:"brands"`
Brand []string `json:"brand" "yunion:deprecated-by":"brands"`
// 列出指定云环境的资源,支持云环境如下:
//

View File

@@ -147,15 +147,15 @@ type CloudproviderResourceInput struct {
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
Manager string `json:"manager" deprecated-by:"cloudprovider"`
Manager string `json:"manager" "yunion:deprecated-by":"cloudprovider"`
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
ManagerId string `json:"manager_id" deprecated-by:"cloudprovider"`
ManagerId string `json:"manager_id" "yunion:deprecated-by":"cloudprovider"`
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
CloudproviderId string `json:"cloudprovider_id" deprecated-by:"cloudprovider"`
CloudproviderId string `json:"cloudprovider_id" "yunion:deprecated-by":"cloudprovider"`
}
type ManagedResourceListInput struct {
@@ -169,15 +169,15 @@ type ManagedResourceListInput struct {
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
CloudaccountId string `json:"cloudaccount_id" deprecated-by:"cloudaccount"`
CloudaccountId string `json:"cloudaccount_id" "yunion:deprecated-by":"cloudaccount"`
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
Account string `json:"account" deprecated-by:"cloudaccount"`
Account string `json:"account" "yunion:deprecated-by":"cloudaccount"`
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
AccountId string `json:"account_id" deprecated-by:"cloudaccount"`
AccountId string `json:"account_id" "yunion:deprecated-by":"cloudaccount"`
// 过滤资源是否为非OneCloud内置私有云管理的资源
// default: false

View File

@@ -306,7 +306,7 @@ type DBInstanceResourceInput struct {
// swagger:ignore
// Deprecated
DBInstanceId string `json:"dbinstance_id" deprecated-by:"dbinstance"`
DBInstanceId string `json:"dbinstance_id" "yunion:deprecated-by":"dbinstance"`
}
type DBInstanceFilterListInputBase struct {

View File

@@ -88,7 +88,7 @@ type SnapshotPolicyResourceInput struct {
// swagger:ignore
// Deprecated
// filter disk by snapshotpolicy_id
SnapshotpolicyId string `json:"snapshotpolicy_id" deprecated-by:"snapshotpolicy"`
SnapshotpolicyId string `json:"snapshotpolicy_id" "yunion:deprecated-by":"snapshotpolicy"`
}
type SnapshotPolicyFilterListInput struct {
@@ -113,7 +113,7 @@ type DiskListInput struct {
// swagger:ignore
// Deprecated
// filter by disk type
Type string `json:"type" deprecated-by:"disk_type"`
Type string `json:"type" "yunion:deprecated-by":"disk_type"`
// 过滤指定disk_type的磁盘列表可能的值为sys, data, swap. volume
//
// | disk_type值 | 说明 |
@@ -137,13 +137,13 @@ type DiskListInput struct {
Template string `json:"template"`
// swagger:ignore
// Deprecated
TemplateId string `json:"template_id" deprecated-by:"template"`
TemplateId string `json:"template_id" "yunion:deprecated-by":"template"`
// 快照
Snapshot string `json:"snapshot"`
// swagger:ignore
// Deprecated
SnapshotId string `json:"snapshot_id" deprecated-by:"snapshot"`
SnapshotId string `json:"snapshot_id" "yunion:deprecated-by":"snapshot"`
}
type DiskResourceInput struct {
@@ -152,7 +152,7 @@ type DiskResourceInput struct {
// swagger:ignore
// Deprecated
// filter by disk_id
DiskId string `json:"disk_id" deprecated-by:"disk"`
DiskId string `json:"disk_id" "yunion:deprecated-by":"disk"`
}
type DiskFilterListInputBase struct {

View File

@@ -53,7 +53,7 @@ type ELasticcacheResourceInput struct {
// swagger:ignore
// Deprecated
ElasticcacheId string `json:"elasticcache_id" deprecated-by:"elasticcache"`
ElasticcacheId string `json:"elasticcache_id" "yunion:deprecated-by":"elasticcache"`
}
type ElasticcacheFilterListInput struct {

View File

@@ -24,15 +24,15 @@ type CloudregionResourceInput struct {
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
CloudregionId string `json:"cloudregion_id" deprecated-by:"cloudregion"`
CloudregionId string `json:"cloudregion_id" "yunion:deprecated-by":"cloudregion"`
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
Region string `json:"region" deprecated-by:"cloudregion"`
Region string `json:"region" "yunion:deprecated-by":"cloudregion"`
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
RegionId string `json:"region_id" deprecated-by:"cloudregion"`
RegionId string `json:"region_id" "yunion:deprecated-by":"cloudregion"`
}
type RegionalFilterListInput struct {
@@ -117,5 +117,5 @@ type ZoneResourceInput struct {
// swagger:ignore
// Deprecated
ZoneId string `json:"zone_id" deprecated-by:"zone"`
ZoneId string `json:"zone_id" "yunion:deprecated-by":"zone"`
}

View File

@@ -39,7 +39,7 @@ type GlobalVpcResourceInput struct {
// swagger:ignore
// Deprecated
GlobalvpcId string `json:"globalvpc_id" deprecated-by:"globalvpc"`
GlobalvpcId string `json:"globalvpc_id" "yunion:deprecated-by":"globalvpc"`
}
type GlobalVpcResourceListInput struct {

View File

@@ -262,15 +262,15 @@ type ServerResourceInput struct {
// swagger:ignore
// Deprecated
// Filter by guest Id
ServerId string `json:"server_id" deprecated-by:"server"`
ServerId string `json:"server_id" "yunion:deprecated-by":"server"`
// swagger:ignore
// Deprecated
// Filter by guest Id
Guest string `json:"guest" deprecated-by:"server"`
Guest string `json:"guest" "yunion:deprecated-by":"server"`
// swagger:ignore
// Deprecated
// Filter by guest Id
GuestId string `json:"guest_id" deprecated-by:"server"`
GuestId string `json:"guest_id" "yunion:deprecated-by":"server"`
}
type ServerFilterListInput struct {

View File

@@ -217,7 +217,7 @@ type HostResourceInput struct {
// swagger:ignore
// Deprecated
// filter by host_id
HostId string `json:"host_id" deprecated-by:"host"`
HostId string `json:"host_id" "yunion:deprecated-by":"host"`
}
type HostRegisterMetadata struct {

View File

@@ -21,7 +21,7 @@ type HostJointResourceDetailsBase struct {
Host string `json:"host"`
// 裸金属服务器名称
// Deprecated
Baremetal string `json:"baremetal" deprecated-by:"host"`
Baremetal string `json:"baremetal" "yunion:deprecated-by":"host"`
}
type HostJointResourceDetails struct {

View File

@@ -150,7 +150,7 @@ type GuestTemplateFilterListInput struct {
GuestTemplate string `json:"guest_template"`
// swagger:ignore
// Deprecated
GuestTemplateId string `json:"guest_template_id" deprecated-by:"guest_template"`
GuestTemplateId string `json:"guest_template_id" "yunion:deprecated-by":"guest_template"`
}
type ServiceCatalogListInput struct {

View File

@@ -50,7 +50,7 @@ type GroupResourceInput struct {
// swagger:ignore
// Deprecated
// Filter by instance group Id
GroupId string `json:"group_id" deprecated-by:"group"`
GroupId string `json:"group_id" "yunion:deprecated-by":"group"`
}
type GroupFilterListInput struct {

View File

@@ -202,7 +202,7 @@ type LoadbalancerResourceInput struct {
// swagger:ignore
// Deprecated
LoadbalancerId string `json:"loadbalancer_id" deprecated-by:"loadbalancer"`
LoadbalancerId string `json:"loadbalancer_id" "yunion:deprecated-by":"loadbalancer"`
}
type LoadbalancerFilterListInput struct {

View File

@@ -39,7 +39,7 @@ type LoadbalancerBackendGroupResourceInput struct {
// swagger:ignore
// Deprecated
BackendGroupId string `json:"backend_group_id" deprecated-by:"backend_group"`
BackendGroupId string `json:"backend_group_id" "yunion:deprecated-by":"backend_group"`
}
type LoadbalancerBackendGroupFilterListInput struct {

View File

@@ -45,7 +45,7 @@ type LoadbalancerClusterResourceInput struct {
// swagger:ignore
// Deprecated
ClusterId string `json:"cluster_id" deprecated-by:"cluster"`
ClusterId string `json:"cluster_id" "yunion:deprecated-by":"cluster"`
}
type LoadbalancerClusterFilterListInput struct {

View File

@@ -45,7 +45,7 @@ type LoadbalancerListenerResourceInput struct {
// 负载均衡监听器ID
// swagger:ignore
// Deprecated
ListenerId string `json:"listener_id" deprecated-by:"listener"`
ListenerId string `json:"listener_id" "yunion:deprecated-by":"listener"`
}
type LoadbalancerListenerFilterListInput struct {

View File

@@ -89,7 +89,7 @@ type NatGatewayResourceInput struct {
// swagger:ignore
// Deprecated
NatgatewayId string `json:"natgateway_id" deprecated-by:"natgateway"`
NatgatewayId string `json:"natgateway_id" "yunion:deprecated-by":"natgateway"`
}
type NatGatewayFilterListInput struct {

View File

@@ -24,7 +24,7 @@ type WireResourceInput struct {
// swagger:ignore
// Deprecated
// fitler by wire id
WireId string `json:"wire_id" deprecated-by:"wire"`
WireId string `json:"wire_id" "yunion:deprecated-by":"wire"`
}
type WireFilterListBase struct {
@@ -47,7 +47,7 @@ type NetworkResourceInput struct {
// swagger:ignore
// Deprecated
// filter by networkId
NetworkId string `json:"network_id" deprecated-by:"network"`
NetworkId string `json:"network_id" "yunion:deprecated-by":"network"`
}
type NetworkFilterListBase struct {

View File

@@ -45,7 +45,7 @@ type SchedtagResourceInput struct {
// swagger:ignore
// Deprecated
// filter by schedtag_id
SchedtagId string `json:"schedtag_id" deprecated-by:"schedtag"`
SchedtagId string `json:"schedtag_id" "yunion:deprecated-by":"schedtag"`
}
type SchedtagFilterListInput struct {
@@ -69,7 +69,7 @@ type SchedtagListInput struct {
// swagger:ignore
// Deprecated
// filter by type, alias for resource_type
Type string `json:"type" deprecated-by:"resource_type"`
Type string `json:"type" "yunion:deprecated-by":"resource_type"`
DefaultStrategy []string `json:"default_strategy"`
}

View File

@@ -178,7 +178,7 @@ type SecgroupResourceInput struct {
// swagger:ignore
// Deprecated
// filter by secgroup_id
SecgroupId string `json:"secgroup_id" deprecated-by:"secgroup"`
SecgroupId string `json:"secgroup_id" "yunion:deprecated-by":"secgroup"`
}
type SecgroupFilterListInput struct {

View File

@@ -144,7 +144,7 @@ type StorageResourceInput struct {
// swagger:ignore
// Deprecated
// filter by storage_id
StorageId string `json:"storage_id" deprecated-by:"storage"`
StorageId string `json:"storage_id" "yunion:deprecated-by":"storage"`
}
type StorageFilterListInputBase struct {

View File

@@ -48,13 +48,13 @@ type StoragecachedimageListInput struct {
Storagecache string `json:"storagecache"`
// Deprecated
// swagger:ignore
StoragecacheId string `json:"storagecache_id" deprecated-by:"storagecache"`
StoragecacheId string `json:"storagecache_id" "yunion:deprecated-by":"storagecache"`
// 以镜像缓存过滤
Cachedimage string `json:"cachedimage"`
// Deprecated
// swagger:ignore
CachedimageId string `json:"cachedimage_id" deprecated-by:"cachedimage_id"`
CachedimageId string `json:"cachedimage_id" "yunion:deprecated-by":"cachedimage"`
// 镜像状态
Status []string `json:"status"`

View File

@@ -80,7 +80,7 @@ type VpcResourceInput struct {
// swagger:ignore
// Deprecated
// filter by vpc Id
VpcId string `json:"vpc_id" deprecated-by:"vpc"`
VpcId string `json:"vpc_id" "yunion:deprecated-by":"vpc"`
}
type VpcFilterListInputBase struct {

View File

@@ -68,10 +68,10 @@ type IdentityProviderCreateInput struct {
Template string `json:"template"`
// 默认导入用户和组的域
TargetDomainId string `json:"target_domain_id"`
TargetDomain string `json:"target_domain"`
// swagger:ignore
// Deprecated
TargetDomain string `json:"target_domain" "yunion:deprecated-by":"target_domain_id"`
TargetDomainId string `json:"target_domain_id" "yunion:deprecated-by":"target_domain"`
// 新建域的时候是否自动新建第一个项目
AutoCreateProject *bool `json:"auto_create_project"`

View File

@@ -48,22 +48,22 @@ type ProjectFilterListInput struct {
ProjectDomain string `json:"project_domain"`
// swagger:ignore
// Deprecated
ProjectDomainId string `json:"project_domain_id" deprecated-by:"project-domain"`
ProjectDomainId string `json:"project_domain_id" "yunion:deprecated-by":"project-domain"`
// 以项目ID或Name过滤列表结果
Project string `json:"project"`
// swagger:ignore
// Deprecated
// filter by project_id
ProjectId string `json:"project_id" deprecated-by:"project"`
ProjectId string `json:"project_id" "yunion:deprecated-by":"project"`
// swagger:ignore
// Deprecated
// filter by tenant
Tenant string `json:"tenant" deprecated-by:"project"`
Tenant string `json:"tenant" "yunion:deprecated-by":"project"`
// swagger:ignore
// Deprecated
// filter by tenant_id
TenantId string `json:"tenant_id" deprecated-by:"project"`
TenantId string `json:"tenant_id" "yunion:deprecated-by":"project"`
}
type UserFilterListInput struct {
@@ -78,7 +78,7 @@ type UserFilterListInput struct {
// swagger:ignore
// Deprecated
// filter by user_id
UserId string `json:"user_id" deprecated-by:"user"`
UserId string `json:"user_id" "yunion:deprecated-by":"user"`
}
type GroupFilterListInput struct {
@@ -93,7 +93,7 @@ type GroupFilterListInput struct {
// swagger:ignore
// Deprecated
// filter by group_id
GroupId string `json:"group_id" deprecated-by:"group"`
GroupId string `json:"group_id" "yunion:deprecated-by":"group"`
}
type RoleFilterListInput struct {
@@ -108,7 +108,7 @@ type RoleFilterListInput struct {
// swagger:ignore
// Deprecated
// filter by role_id
RoleId string `json:"role_id" deprecated-by:"role"`
RoleId string `json:"role_id" "yunion:deprecated-by":"role"`
}
type ServiceFilterListInput struct {
@@ -120,7 +120,7 @@ type ServiceFilterListInput struct {
// swagger:ignore
// Deprecated
// filter by service_id
ServiceId string `json:"service_id" deprecated-by:"service"`
ServiceId string `json:"service_id" "yunion:deprecated-by":"service"`
// 以服务名称排序
OrderByService string `json:"order_by_service"`
@@ -320,7 +320,7 @@ type RegionFilterListInput struct {
Region string `json:"region"`
// swagger:ignore
// Deprecated
RegionId string `json:"region_id" deprecated-by:"region"`
RegionId string `json:"region_id" "yunion:deprecated-by":"region"`
}
type RegionListInput struct {

View File

@@ -21,15 +21,15 @@ type DomainizedResourceInput struct {
// swagger:ignore
// Deprecated
Domain string `json:"domain" deprecated-by:"project_domain"`
Domain string `json:"domain" "yunion:deprecated-by":"project_domain"`
// swagger:ignore
// Deprecated
// Project domain Id filter, alias for project_domain
ProjectDomainId string `json:"project_domain_id" deprecated-by:"project_domain"`
ProjectDomainId string `json:"project_domain_id" "yunion:deprecated-by":"project_domain"`
// swagger:ignore
// Deprecated
// Domain Id filter, alias for project_domain
DomainId string `json:"domain_id" deprecated-by:"project_domain"`
DomainId string `json:"domain_id" "yunion:deprecated-by":"project_domain"`
}
type ProjectizedResourceInput struct {
@@ -39,15 +39,15 @@ type ProjectizedResourceInput struct {
// swagger:ignore
// Deprecated
// Filter by project_id, alias for project
ProjectId string `json:"project_id" deprecated-by:"project"`
ProjectId string `json:"project_id" "yunion:deprecated-by":"project"`
// swagger:ignore
// Deprecated
// Filter by tenant ID or Name, alias for project
Tenant string `json:"tenant" deprecated-by:"project"`
Tenant string `json:"tenant" "yunion:deprecated-by":"project"`
// swagger:ignore
// Deprecated
// Filter by tenant_id, alias for project
TenantId string `json:"tenant_id" deprecated-by:"project"`
TenantId string `json:"tenant_id" "yunion:deprecated-by":"project"`
}
type DomainizedResourceCreateInput struct {

View File

@@ -50,7 +50,7 @@ type ProjectizedResourceListInput struct {
OrderByProject string `json:"order_by_project"`
// swagger:ignore
// Deprecated
OrderByTenant string `json:"order_by_tenant" deprecated-by:"order_by_project"`
OrderByTenant string `json:"order_by_tenant" "yunion:deprecated-by":"order_by_project"`
}
type UserResourceListInput struct {
@@ -59,7 +59,7 @@ type UserResourceListInput struct {
// swagger:ignore
// Deprecated
// Filter by userId
UserId string `json:"user_id" deprecated-by:"user"`
UserId string `json:"user_id" "yunion:deprecated-by":"user"`
}
type ModelBaseListInput struct {

View File

@@ -133,11 +133,11 @@ type ProjectizedResourceInfo struct {
// 资源归属项目的ID(向后兼容别名)
// Deprecated
TenantId string `json:"project_id" deprecated-by:"tenant_id"`
TenantId string `json:"project_id" "yunion:deprecated-by":"tenant_id"`
// 资源归属项目的名称(向后兼容别名)
// Deprecated
Tenant string `json:"project" deprecated-by:"tenant"`
Tenant string `json:"project" "yunion:deprecated-by":"tenant"`
}
type ScopedResourceBaseInfo struct {

View File

@@ -28,14 +28,14 @@ type ParameterListInput struct {
// Deprecated
// swagger:ignore
ServiceId string `json:"service_id" deprecated-by:"service"`
ServiceId string `json:"service_id" "yunion:deprecated-by":"service"`
// 用户名称或ID
User string `json:"user"`
// Deprecated
// swagger:ignore
UserId string `json:"user_id" deprecated-by:"user"`
UserId string `json:"user_id" "yunion:deprecated-by":"user"`
// filter by name
Name []string `json:"name"`

View File

@@ -402,7 +402,7 @@ func FetchServerCreateInputByJSON(obj jsonutils.JSONObject) (*compute.ServerCrea
input.InstanceType = skuName
}
if keypair := jsonutils.GetAnyString(obj, []string{"keypair", "keypair_id"}); keypair != "" {
input.KeypairId = keypair
input.Keypair = keypair
}
if secgroup := jsonutils.GetAnyString(obj, []string{"secgroup", "secgroup_id", "secgrp_id"}); len(secgroup) != 0 {
input.SecgroupId = secgroup

View File

@@ -227,14 +227,14 @@ func RegisterReferrer(man db.IModelManager) {
}
func ValidateProxySettingResourceInput(userCred mcclient.TokenCredential, input proxyapi.ProxySettingResourceInput) (*SProxySetting, proxyapi.ProxySettingResourceInput, error) {
m, err := ProxySettingManager.FetchByIdOrName(userCred, input.ProxySettingId)
m, err := ProxySettingManager.FetchByIdOrName(userCred, input.ProxySetting)
if err != nil {
if errors.Cause(err) == sql.ErrNoRows {
return nil, input, errors.Wrapf(httperrors.ErrResourceNotFound, "%s %s", ProxySettingManager.Keyword(), input.ProxySettingId)
return nil, input, errors.Wrapf(httperrors.ErrResourceNotFound, "%s %s", ProxySettingManager.Keyword(), input.ProxySetting)
} else {
return nil, input, errors.Wrapf(err, "ProxySettingManager.FetchByIdOrName")
}
}
input.ProxySettingId = m.GetId()
input.ProxySetting = m.GetId()
return m.(*SProxySetting), input, nil
}

View File

@@ -297,7 +297,7 @@ func (self *SCloudaccount) ValidateUpdateData(
input.Options = optionsJson
}
if len(input.ProxySettingId) > 0 {
if len(input.ProxySetting) > 0 {
var proxySetting *proxy.SProxySetting
proxySetting, input.ProxySettingResourceInput, err = proxy.ValidateProxySettingResourceInput(userCred, input.ProxySettingResourceInput)
if err != nil {
@@ -391,8 +391,8 @@ func (manager *SCloudaccountManager) ValidateCreateData(
var proxyFunc httputils.TransportProxyFunc
{
if input.ProxySettingId == "" {
input.ProxySettingId = proxyapi.ProxySettingId_DIRECT
if input.ProxySetting == "" {
input.ProxySetting = proxyapi.ProxySettingId_DIRECT
}
var proxySetting *proxy.SProxySetting
proxySetting, input.ProxySettingResourceInput, err = proxy.ValidateProxySettingResourceInput(userCred, input.ProxySettingResourceInput)

View File

@@ -366,8 +366,8 @@ func (gt *SGuestTemplate) getMoreDetails(ctx context.Context, userCred mcclient.
configInfo.Disks = disks
// keypair
if len(input.KeypairId) > 0 {
model, err := KeypairManager.FetchById(input.KeypairId)
if len(input.Keypair) > 0 {
model, err := KeypairManager.FetchByIdOrName(userCred, input.Keypair)
if err == nil {
keypair := model.(*SKeypair)
configInfo.Keypair = keypair.GetName()
@@ -482,7 +482,7 @@ func (gt *SGuestTemplate) PerformPublic(
// check for below private resource in the guest template
privateResource := map[string]int{
"keypair": len(input.KeypairId),
"keypair": len(input.Keypair),
"instance group": len(input.InstanceGroupIds),
"instance snapshot": len(input.InstanceSnapshotId),
}

View File

@@ -1272,13 +1272,13 @@ func (manager *SGuestManager) validateCreateData(
input.IsolatedDevices[idx] = devConfig
}
keypairId := input.KeypairId
keypairId := input.Keypair
if len(keypairId) > 0 {
keypairObj, err := KeypairManager.FetchByIdOrName(userCred, keypairId)
if err != nil {
return nil, httperrors.NewResourceNotFoundError("Keypair %s not found", keypairId)
}
input.KeypairId = keypairObj.GetId()
input.Keypair = keypairObj.GetId()
}
secGrpIds := []string{}
@@ -4880,7 +4880,7 @@ func (self *SGuest) ToCreateInput(userCred mcclient.TokenCredential) *api.Server
userInput.ShutdownBehavior = genInput.ShutdownBehavior
userInput.IsSystem = genInput.IsSystem
userInput.SecgroupId = genInput.SecgroupId
userInput.KeypairId = genInput.KeypairId
userInput.Keypair = genInput.Keypair
userInput.EipBw = genInput.EipBw
userInput.EipChargeType = genInput.EipChargeType
// cloned server should belongs to the project creating it
@@ -4942,7 +4942,7 @@ func (self *SGuest) toCreateInput() *api.ServerCreateInput {
r.IsolatedDevices = self.ToIsolatedDevicesConfig()
if keypair := self.getKeypair(); keypair != nil {
r.KeypairId = keypair.Id
r.Keypair = keypair.Id
}
if host := self.GetHost(); host != nil {
r.ResourceType = host.ResourceType

View File

@@ -315,7 +315,7 @@ func (self *SInstanceSnapshot) ToInstanceCreateInput(
sourceInput.VcpuCount = serverConfig.Ncpu
}
if len(self.KeypairId) > 0 {
sourceInput.KeypairId = self.KeypairId
sourceInput.Keypair = self.KeypairId
}
if self.SecGroups != nil {
secGroups := make([]string, 0)

View File

@@ -304,7 +304,7 @@ func (manager *SIdentityProviderManager) ValidateCreateData(
}
}
targetDomainStr := input.TargetDomainId
targetDomainStr := input.TargetDomain
if len(targetDomainStr) > 0 {
domain, err := DomainManager.FetchDomainById(targetDomainStr)
if err != nil {
@@ -314,7 +314,7 @@ func (manager *SIdentityProviderManager) ValidateCreateData(
return input, httperrors.NewGeneralError(err)
}
}
input.TargetDomainId = domain.Id
input.TargetDomain = domain.Id
}
var err error

View File

@@ -376,7 +376,7 @@ func (opts *ServerCreateOptionalOptions) OptionalParams() (*computeapi.ServerCre
params := &computeapi.ServerCreateInput{
ServerConfigs: config,
VcpuCount: opts.VcpuCount,
KeypairId: opts.Keypair,
Keypair: opts.Keypair,
Password: opts.Password,
Cdrom: opts.Iso,
Vga: opts.Vga,

2
vendor/modules.txt vendored
View File

@@ -1019,7 +1019,7 @@ yunion.io/x/jsonutils
# yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3
yunion.io/x/log
yunion.io/x/log/hooks
# yunion.io/x/pkg v0.0.0-20200415124010-2c7da30b998f
# yunion.io/x/pkg v0.0.0-20200416145704-22c189971435
yunion.io/x/pkg/errors
yunion.io/x/pkg/gotypes
yunion.io/x/pkg/prettytable

View File

@@ -16,11 +16,8 @@ package prettytable
import (
"bytes"
"os"
"strings"
"unicode"
"golang.org/x/sys/unix"
)
type AlignmentType uint8
@@ -56,15 +53,6 @@ func NewPrettyTable(fields []string) *PrettyTable {
return &pt
}
func termWidth() (int, error) {
fd := int(os.Stdout.Fd())
wsz, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
if err != nil {
return -1, err
}
return int(wsz.Col), nil
}
func rowLine(buf *bytes.Buffer, widths []int) {
buf.WriteByte('+')
for _, w := range widths {

32
vendor/yunion.io/x/pkg/prettytable/termwidth_unix.go generated vendored Normal file
View File

@@ -0,0 +1,32 @@
// Copyright 2019 Yunion
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build !windows
package prettytable
import (
"os"
"golang.org/x/sys/unix"
)
func termWidth() (int, error) {
fd := int(os.Stdout.Fd())
wsz, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
if err != nil {
return -1, err
}
return int(wsz.Col), nil
}

View File

@@ -0,0 +1,34 @@
// Copyright 2019 Yunion
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build windows
package prettytable
import (
"os"
"golang.org/x/sys/windows"
)
func termWidth() (int, error) {
var (
h = windows.Handle(os.Stdout.Fd())
info windows.ConsoleScreenBufferInfo
)
if err := windows.GetConsoleScreenBufferInfo(h, &info); err != nil {
return -1, err
}
return int(info.Size.X), nil
}