mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #9102 from ioito/hotfix/qx-code-gen-api
fix(region): code gen api error
This commit is contained in:
@@ -334,7 +334,7 @@ type GetNetworkAddressesInput struct {
|
||||
|
||||
type GetNetworkAddressesOutput struct {
|
||||
// IP子网地址记录
|
||||
Addresses []SNetworkAddress `json:"addresses"`
|
||||
Addresses []SNetworkUsedAddress `json:"addresses"`
|
||||
}
|
||||
|
||||
type NetworkSetBgpTypeInput struct {
|
||||
|
||||
@@ -75,7 +75,7 @@ const (
|
||||
IPAllocationDefault = ""
|
||||
)
|
||||
|
||||
type SNetworkAddress struct {
|
||||
type SNetworkUsedAddress struct {
|
||||
IpAddr string
|
||||
MacAddr string
|
||||
Owner string
|
||||
|
||||
@@ -96,7 +96,7 @@ type SBucket struct {
|
||||
|
||||
// SCachedLoadbalancerAcl is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SCachedLoadbalancerAcl.
|
||||
type SCachedLoadbalancerAcl struct {
|
||||
apis.SSharableVirtualResourceBase
|
||||
apis.SVirtualResourceBase
|
||||
apis.SExternalizedResourceBase
|
||||
SManagedResourceBase
|
||||
SCloudregionResourceBase
|
||||
@@ -361,6 +361,8 @@ type SDBInstance struct {
|
||||
Zone2 string `json:"zone2"`
|
||||
// 可用区3
|
||||
Zone3 string `json:"zone3"`
|
||||
// 从备份创建新实例
|
||||
DBInstancebackupId string `json:"dbinstancebackup_id"`
|
||||
}
|
||||
|
||||
// SDBInstanceAccount is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SDBInstanceAccount.
|
||||
@@ -396,6 +398,8 @@ type SDBInstanceBackup struct {
|
||||
// 备份大小
|
||||
// example: 32
|
||||
BackupSizeMb int `json:"backup_size_mb"`
|
||||
// 备份方式 Logical|Physical
|
||||
BackupMethod string `json:"backup_method"`
|
||||
}
|
||||
|
||||
// SDBInstanceDatabase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SDBInstanceDatabase.
|
||||
@@ -492,6 +496,7 @@ type SDisk struct {
|
||||
apis.SExternalizedResourceBase
|
||||
SBillingResourceBase
|
||||
SStorageResourceBase
|
||||
apis.SMultiArchResourceBase
|
||||
// 磁盘存储类型
|
||||
// example: qcow2
|
||||
DiskFormat string `json:"disk_format"`
|
||||
@@ -517,8 +522,6 @@ type SDisk struct {
|
||||
// swap: 交换盘
|
||||
// example: sys
|
||||
DiskType string `json:"disk_type"`
|
||||
// cpu架构
|
||||
OsArch string `json:"os_arch"`
|
||||
// # is persistent
|
||||
Nonpersistent bool `json:"nonpersistent"`
|
||||
// 是否标记为SSD磁盘
|
||||
@@ -889,6 +892,7 @@ type SGuest struct {
|
||||
apis.SExternalizedResourceBase
|
||||
SBillingResourceBase
|
||||
SDeletePreventableResourceBase
|
||||
apis.SMultiArchResourceBase
|
||||
SHostResourceBase
|
||||
// CPU大小
|
||||
VcpuCount int `json:"vcpu_count"`
|
||||
@@ -920,9 +924,6 @@ type SGuest struct {
|
||||
// 虚拟化技术
|
||||
// example: kvm
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
// 虚拟机CPU架构
|
||||
// example: x86 arm
|
||||
OsArch string `json:"os_arch"`
|
||||
// 套餐名称
|
||||
InstanceType string `json:"instance_type"`
|
||||
}
|
||||
@@ -1207,6 +1208,8 @@ type SInstanceSnapshot struct {
|
||||
apis.SVirtualResourceBase
|
||||
apis.SExternalizedResourceBase
|
||||
SManagedResourceBase
|
||||
SCloudregionResourceBase
|
||||
apis.SMultiArchResourceBase
|
||||
// 云主机Id
|
||||
GuestId string `json:"guest_id"`
|
||||
// 云主机配置
|
||||
@@ -1223,10 +1226,10 @@ type SInstanceSnapshot struct {
|
||||
KeypairId string `json:"keypair_id"`
|
||||
// 操作系统类型
|
||||
OsType string `json:"os_type"`
|
||||
// CPU架构
|
||||
OsArch string `json:"os_arch"`
|
||||
// 套餐名称
|
||||
InstanceType string `json:"instance_type"`
|
||||
// 主机快照磁盘容量和
|
||||
SizeMb int `json:"size_mb"`
|
||||
}
|
||||
|
||||
// SInstanceSnapshotJoint is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SInstanceSnapshotJoint.
|
||||
@@ -1237,6 +1240,37 @@ type SInstanceSnapshotJoint struct {
|
||||
DiskIndex byte `json:"disk_index"`
|
||||
}
|
||||
|
||||
// SInterVpcNetwork is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SInterVpcNetwork.
|
||||
type SInterVpcNetwork struct {
|
||||
apis.SEnabledStatusInfrasResourceBase
|
||||
apis.SExternalizedResourceBase
|
||||
SManagedResourceBase
|
||||
}
|
||||
|
||||
// SInterVpcNetworkResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SInterVpcNetworkResourceBase.
|
||||
type SInterVpcNetworkResourceBase struct {
|
||||
InterVpcNetworkId string `json:"inter_vpc_network_id"`
|
||||
}
|
||||
|
||||
// SInterVpcNetworkRouteSet is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SInterVpcNetworkRouteSet.
|
||||
type SInterVpcNetworkRouteSet struct {
|
||||
apis.SEnabledStatusStandaloneResourceBase
|
||||
apis.SExternalizedResourceBase
|
||||
SVpcResourceBase
|
||||
InterVpcNetworkId string `json:"inter_vpc_network_id"`
|
||||
Cidr string `json:"cidr"`
|
||||
ExtInstanceId string `json:"ext_instance_id"`
|
||||
ExtInstanceType string `json:"ext_instance_type"`
|
||||
ExtInstanceRegionId string `json:"ext_instance_region_id"`
|
||||
}
|
||||
|
||||
// SInterVpcNetworkVpc is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SInterVpcNetworkVpc.
|
||||
type SInterVpcNetworkVpc struct {
|
||||
apis.SJointResourceBase
|
||||
SInterVpcNetworkResourceBase
|
||||
VpcId string `json:"vpc_id"`
|
||||
}
|
||||
|
||||
// SIsolatedDevice is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SIsolatedDevice.
|
||||
type SIsolatedDevice struct {
|
||||
apis.SStandaloneResourceBase
|
||||
@@ -1430,7 +1464,7 @@ type SLoadbalancerBackendgroupResourceBase struct {
|
||||
|
||||
// SLoadbalancerCertificate is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SLoadbalancerCertificate.
|
||||
type SLoadbalancerCertificate struct {
|
||||
apis.SVirtualResourceBase
|
||||
apis.SSharableVirtualResourceBase
|
||||
apis.SExternalizedResourceBase
|
||||
apis.SCertificateResourceBase
|
||||
}
|
||||
@@ -1704,6 +1738,17 @@ type SNetwork struct {
|
||||
BgpType string `json:"bgp_type"`
|
||||
}
|
||||
|
||||
// SNetworkAddress is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SNetworkAddress.
|
||||
type SNetworkAddress struct {
|
||||
apis.SStandaloneAnonResourceBase
|
||||
Type string `json:"type"`
|
||||
ParentType string `json:"parent_type"`
|
||||
ParentId string `json:"parent_id"`
|
||||
SNetworkResourceBase
|
||||
IpAddr string `json:"ip_addr"`
|
||||
SubCtrVid int `json:"sub_ctr_vid"`
|
||||
}
|
||||
|
||||
// SNetworkInterface is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SNetworkInterface.
|
||||
type SNetworkInterface struct {
|
||||
apis.SStatusInfrasResourceBase
|
||||
@@ -2127,6 +2172,7 @@ type SSnapshot struct {
|
||||
apis.SExternalizedResourceBase
|
||||
SManagedResourceBase
|
||||
SCloudregionResourceBase
|
||||
apis.SMultiArchResourceBase
|
||||
// 磁盘Id
|
||||
DiskId string `json:"disk_id"`
|
||||
// Only onecloud has StorageId
|
||||
@@ -2140,7 +2186,6 @@ type SSnapshot struct {
|
||||
DiskType string `json:"disk_type"`
|
||||
// 操作系统类型
|
||||
OsType string `json:"os_type"`
|
||||
OsArch string `json:"os_arch"`
|
||||
// create disk from snapshot, snapshot as disk backing file
|
||||
RefCount int `json:"ref_count"`
|
||||
BackingDiskId string `json:"backing_disk_id"`
|
||||
|
||||
@@ -21,9 +21,8 @@ import (
|
||||
// SGuestImage is an autogenerated struct via yunion.io/x/onecloud/pkg/image/models.SGuestImage.
|
||||
type SGuestImage struct {
|
||||
apis.SSharableVirtualResourceBase
|
||||
apis.SMultiArchResourceBase
|
||||
Protected *bool `json:"protected,omitempty"`
|
||||
// 操作系统CPU架构
|
||||
OsArch string `json:"os_arch"`
|
||||
}
|
||||
|
||||
// SGuestImageJoint is an autogenerated struct via yunion.io/x/onecloud/pkg/image/models.SGuestImageJoint.
|
||||
@@ -36,6 +35,7 @@ type SGuestImageJoint struct {
|
||||
// SImage is an autogenerated struct via yunion.io/x/onecloud/pkg/image/models.SImage.
|
||||
type SImage struct {
|
||||
apis.SSharableVirtualResourceBase
|
||||
apis.SMultiArchResourceBase
|
||||
// 镜像大小, 单位Byte
|
||||
Size int64 `json:"size"`
|
||||
// 存储地址
|
||||
@@ -59,8 +59,6 @@ type SImage struct {
|
||||
IsGuestImage *bool `json:"is_guest_image,omitempty"`
|
||||
// 是否是数据盘镜像
|
||||
IsData *bool `json:"is_data,omitempty"`
|
||||
// 操作系统CPU架构
|
||||
OsArch string `json:"os_arch"`
|
||||
// image copy from url, save origin checksum before probe
|
||||
// 从镜像时长导入的镜像校验和
|
||||
OssChecksum string `json:"oss_checksum"`
|
||||
|
||||
@@ -62,7 +62,7 @@ type SReceiverNotification struct {
|
||||
apis.SJointResourceBase
|
||||
ReceiverID string `json:"receiver_id"`
|
||||
NotificationID string `json:"notification_id"`
|
||||
// ignore if ReceiverID is not empty
|
||||
// ignore if ReceiverID is not empty or default
|
||||
Contact string `json:"contact"`
|
||||
SendBy string `json:"send_by"`
|
||||
Status string `json:"status"`
|
||||
|
||||
@@ -124,6 +124,13 @@ type SMetadata struct {
|
||||
Deleted bool `json:"deleted"`
|
||||
}
|
||||
|
||||
// SMultiArchResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudcommon/db.SMultiArchResourceBase.
|
||||
type SMultiArchResourceBase struct {
|
||||
// 操作系统 CPU 架构
|
||||
// example: x86 arm
|
||||
OsArch string `json:"os_arch"`
|
||||
}
|
||||
|
||||
// SOpsLog is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudcommon/db.SOpsLog.
|
||||
type SOpsLog struct {
|
||||
Id int64 `json:"id"`
|
||||
@@ -200,13 +207,11 @@ type SSharedResource struct {
|
||||
TargetType string `json:"target_type"`
|
||||
}
|
||||
|
||||
// SStandaloneResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudcommon/db.SStandaloneResourceBase.
|
||||
type SStandaloneResourceBase struct {
|
||||
// SStandaloneAnonResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudcommon/db.SStandaloneAnonResourceBase.
|
||||
type SStandaloneAnonResourceBase struct {
|
||||
SResourceBase
|
||||
// 资源UUID
|
||||
Id string `json:"id"`
|
||||
// 资源名称
|
||||
Name string `json:"name"`
|
||||
// 资源描述信息
|
||||
Description string `json:"description"`
|
||||
// 是否是模拟资源, 部分从公有云上同步的资源并不真实存在, 例如宿主机
|
||||
@@ -214,6 +219,13 @@ type SStandaloneResourceBase struct {
|
||||
IsEmulated bool `json:"is_emulated"`
|
||||
}
|
||||
|
||||
// SStandaloneResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudcommon/db.SStandaloneResourceBase.
|
||||
type SStandaloneResourceBase struct {
|
||||
SStandaloneAnonResourceBase
|
||||
// 资源名称
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// SStatusDomainLevelResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudcommon/db.SStatusDomainLevelResourceBase.
|
||||
type SStatusDomainLevelResourceBase struct {
|
||||
SDomainLevelResourceBase
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// 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.
|
||||
|
||||
// Code generated by model-api-gen. DO NOT EDIT.
|
||||
|
||||
package db
|
||||
|
||||
import (
|
||||
@@ -10,6 +24,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
)
|
||||
|
||||
// +onecloud:model-api-gen
|
||||
type SMultiArchResourceBase struct {
|
||||
// 操作系统 CPU 架构
|
||||
// example: x86 arm
|
||||
|
||||
@@ -2601,11 +2601,11 @@ func (network *SNetwork) getUsedAddressQuery(owner mcclient.IIdentityProvider, s
|
||||
return sqlchemy.Union(queries...).Query()
|
||||
}
|
||||
|
||||
type SNetworkAddressList []api.SNetworkAddress
|
||||
type SNetworkUsedAddressList []api.SNetworkUsedAddress
|
||||
|
||||
func (a SNetworkAddressList) Len() int { return len(a) }
|
||||
func (a SNetworkAddressList) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a SNetworkAddressList) Less(i, j int) bool {
|
||||
func (a SNetworkUsedAddressList) Len() int { return len(a) }
|
||||
func (a SNetworkUsedAddressList) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a SNetworkUsedAddressList) Less(i, j int) bool {
|
||||
ipI, _ := netutils.NewIPV4Addr(a[i].IpAddr)
|
||||
ipJ, _ := netutils.NewIPV4Addr(a[j].IpAddr)
|
||||
return ipI < ipJ
|
||||
@@ -2620,14 +2620,14 @@ func (network *SNetwork) GetDetailsAddresses(ctx context.Context, userCred mccli
|
||||
return output, errors.Wrapf(httperrors.ErrNotSufficientPrivilege, "require %s allow %s", scope, allowScope)
|
||||
}
|
||||
|
||||
netAddrs := make([]api.SNetworkAddress, 0)
|
||||
netAddrs := make([]api.SNetworkUsedAddress, 0)
|
||||
q := network.getUsedAddressQuery(userCred, scope, false)
|
||||
err := q.All(&netAddrs)
|
||||
if err != nil {
|
||||
return output, httperrors.NewGeneralError(err)
|
||||
}
|
||||
|
||||
sort.Sort(SNetworkAddressList(netAddrs))
|
||||
sort.Sort(SNetworkUsedAddressList(netAddrs))
|
||||
|
||||
output.Addresses = netAddrs
|
||||
return output, nil
|
||||
|
||||
Reference in New Issue
Block a user