feature: api -> response struct

This commit is contained in:
Qu Xuan
2020-01-14 17:50:56 +08:00
parent c16dc54112
commit 76d974f6d8
203 changed files with 4338 additions and 2369 deletions

View File

@@ -0,0 +1,26 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type BaremetalagentDetails struct {
apis.StandaloneResourceDetails
SBaremetalagent
// 裸金属代理程序所在的可用区
// example: zone1
Zone string `json:"zone"`
}

View File

@@ -49,10 +49,13 @@ type BucketCreateInput struct {
StorageClass string `json:"storage_class"`
}
type BucketDetail struct {
apis.Meta
type BucketDetails struct {
apis.VirtualResourceDetails
SBucket
CloudproviderDetails
CloudproviderInfo
AccessUrls []cloudprovider.SBucketAccessUrl `json:"access_urls"`
}
type BucketObjectsActionInput struct {

View File

@@ -14,6 +14,8 @@
package compute
import "yunion.io/x/onecloud/pkg/apis"
type CachedImageUncacheImageInput struct {
// 存储缓存名Id
// required: true
@@ -23,3 +25,31 @@ type CachedImageUncacheImageInput struct {
// default: false
IsForce bool `json:"is_force"`
}
type CachedimageDetails struct {
apis.StandaloneResourceDetails
SCachedimage
// 镜像状态, 和info里面的status一致
// example: active
Status string `json:"status"`
// 操作系统类型
// example: FreeBSD
OsType string `json:"os_type"`
// 操作系统发行版
// example: FreeBSD
OsDistribution string `json:"os_distribution"`
// 操作系统版本
// example: 11
OsVersion string `json:"os_version"`
// 虚拟化类型
Hypervisor string `json:"hypervisor"`
// 此镜像被使用次数
// example: 0
CachedCount int `json:"cached_count"`
}

View File

@@ -0,0 +1,24 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type CachedLoadbalancerAclDetails struct {
apis.SharableVirtualResourceDetails
SCachedLoadbalancerAcl
CloudproviderInfo
}

View File

@@ -0,0 +1,24 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type CachedLoadbalancerCertificateDetails struct {
apis.VirtualResourceDetails
SCachedLoadbalancerCertificate
CloudproviderInfo
}

View File

@@ -106,3 +106,75 @@ type CloudaccountListInput struct {
CapabilityListInput
}
type ProviderProject struct {
// 子订阅项目名称
// example: system
Tenant string `json:"tenant"`
// 子订阅项目Id
// 9a48383a-467a-4542-8b50-4e15b0a8715f
TenantId string `json:"tenant_id"`
}
type CloudaccountDetail struct {
apis.StandaloneResourceDetails
SCloudaccount
// 子订阅项目信息
Projects []ProviderProject `json:"projects"`
// 同步时间间隔
// example: 3600
SyncIntervalSeconds int `json:"sync_interval_seconds"`
// 同步状态
SyncStatus2 string `json:"sync_stauts2"`
// 云账号环境类型
// public: 公有云
// private: 私有云
// onpremise: 本地IDC
// example: public
CloudEnv string `json:"cloud_env"`
// 云账号项目名称
// example: system
Tenant string `json:"tenant"`
// 弹性公网Ip数量
// example: 2
EipCount int `json:"eip_count,allowempty"`
// 虚拟私有网络数量
// example: 4
VpcCount int `json:"vpc_count,allowempty"`
// 云盘数量
// example: 12
DiskCount int `json:"disk_count,allowempty"`
// 宿主机数量(不计算虚拟机宿主机数量)
// example: 0
HostCount int `json:"host_count,allowempty"`
// 云主机数量
// example: 4
GuestCount int `json:"guest_count,allowempty"`
// 块存储数量
// example: 12
StorageCount int `json:"storage_count,allowempty"`
// 子订阅数量
// example: 1
ProviderCount int `json:"provider_count,allowempty"`
// 路由表数量
// example: 0
RoutetableCount int `json:"routetable_count,allowempty"`
// 存储缓存数量
// example: 10
StoragecacheCount int `json:"storagecache_count,allowempty"`
}

View File

@@ -21,26 +21,120 @@ import (
"yunion.io/x/onecloud/pkg/cloudprovider"
)
type CloudproviderDetails struct {
Provider string `json:"provider,omitempty"`
Brand string `json:"brand,omitempty"`
Account string `json:"account,omitempty"`
AccountId string `json:"account_id,omitempty"`
Manager string `json:"manager,omitempty"`
ManagerId string `json:"manager_id,omitempty"`
ManagerProject string `json:"manager_project,omitempty"`
type CloudproviderInfo struct {
// 云平台
// example: Google
Provider string `json:"provider,omitempty"`
// 云平台品牌
// example: Google
Brand string `json:"brand,omitempty"`
// 云账号名称
// example: google-account
Account string `json:"account,omitempty"`
// 云账号Id
// example: 4d3c8979-9dd0-439b-8d78-36fe1ab1666c
AccountId string `json:"account_id,omitempty"`
// 子订阅名称
// example: google-account
Manager string `json:"manager,omitempty"`
// 子订阅Id
// example: fa4aaf88-aed8-422d-84e7-56dea533b364
ManagerId string `json:"manager_id,omitempty"`
// 子订阅所在项目名称
// example: system
ManagerProject string `json:"manager_project,omitempty"`
// 子订阅所在项目Id
// example: 4d3c8979-9dd0-439b-8d78-36fe1ab1666c
ManagerProjectId string `json:"manager_project_id,omitempty"`
ManagerDomain string `json:"manager_domain,omitempty"`
ManagerDomainId string `json:"manager_domain_id,omitempty"`
Region string `json:"region,omitempty"`
RegionId string `json:"region_id,omitempty"`
CloudregionId string `json:"cloudregion_id,omitempty"`
// 子订阅所在域名称
// example: Default
ManagerDomain string `json:"manager_domain,omitempty"`
// 子订阅所在域Id
// example: default
ManagerDomainId string `json:"manager_domain_id,omitempty"`
// 区域名称
// example: 腾讯云 华南地区(广州)
Region string `json:"region,omitempty"`
// 区域Id
// example: 6151c89b-77f2-4d43-8ef9-cd03d604a16b
RegionId string `json:"region_id,omitempty"`
// 区域Id
// example: 6151c89b-77f2-4d43-8ef9-cd03d604a16b
CloudregionId string `json:"cloudregion_id,omitempty"`
// 区域外部Id
// Qcloud/ap-guangzhou
RegionExternalId string `json:"region_external_id,omitempty"`
RegionExtId string `json:"region_ext_id,omitempty"`
Zone string `json:"zone,omitempty"`
ZoneId string `json:"zone_id,omitempty"`
ZoneExtId string `json:"zone_ext_id,omitempty"`
CloudEnv string `json:"cloud_env,omitempty"`
// 区域外部Id(不携带平台信息)
// example: ap-guangzhou
RegionExtId string `json:"region_ext_id,omitempty"`
// 可用区名称
// example: 腾讯云 广州四区
Zone string `json:"zone,omitempty"`
// 可用区Id
// example: 336ac6d2-b80d-43bb-86d5-1ebf474da8d4
ZoneId string `json:"zone_id,omitempty"`
// 可用区外部Id
// example: ap-guangzhou-4
ZoneExtId string `json:"zone_ext_id,omitempty"`
// 云环境
// example: public
CloudEnv string `json:"cloud_env,omitempty"`
}
type CloudproviderDetails struct {
apis.StandaloneResourceDetails
SCloudprovider
// 云账号名称
// example: google-account
Cloudaccount string `json:"cloudaccount"`
// 子订阅同步状态
SyncStatus2 string `json:"sync_status2"`
// 支持服务列表
Capabilities []string `json:"capabilities"`
// 云主机数量
// example: 1
GuestCount int `json:"guest_count"`
// 宿主机数量
// example: 2
HostCount int `json:"host_count"`
// 虚拟私有网络数量
// example: 4
VpcCount int `json:"vpc_count"`
// 块存储梳理
// example: 4
StorageCount int `json:"storage_count"`
// 存储缓存数量
// example: 1
StorageCacheCount int `json:"storagecache_count"`
// 弹性公网IP数量
// example: 12
EipCount int `json:"eip_count"`
// 快照数量
// example: 0
SnapshotCount int `json:"snapshot_count"`
// 负载均衡器数量
// example: 2
LoadbalancerCount int `json:"loadbalancer_count"`
// 项目数量
ProjectCount int `json:"project_count"`
// 同步区域数量
SyncRegionCount int `json:"sync_region_count"`
// 子订阅品牌信息
Brand string `json:"brand"`
}
type ManagedResourceListInput struct {

View File

@@ -0,0 +1,41 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type CloudproviderregionDetails struct {
apis.JoinModelBaseDetails
Cloudprovider string
Cloudregion string
// 云账号Id
// example: fa4aaf88-aed8-422d-84e7-56dea533b364
CloudaccountId string `json:"cloudaccount_id"`
// 云账号名称
// example: googl-account
Cloudaccount string `json:"cloudaccount"`
// 云账号所在域Id
// example: 0df40413-eb69-49c7-895e-618ddeb80f55
CloudaccountDomainId string `json:"cloudaccount_domain_id"`
// 是否开启自动同步
// example: false
EnableAutoSync bool `json:"enable_auto_sync"`
// 自动同步周期
// example: 300
SyncIntervalSeconds int `json:"sync_interval_seconds"`
}

View File

@@ -0,0 +1,56 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type CloudregionDetails struct {
apis.StandaloneResourceDetails
SCloudregion
// 虚拟私有网络数量
// example: 2
VpcCount int `json:"vpc_count,allowempty"`
// 可用区数量
// example: 3
ZoneCount int `json:"zone_count,allowempty"`
// 云主机梳理
// example: 2
GuestCount int `json:"guest_count,allowempty"`
// IP子网数量
// example: 12
NetworkCount int `json:"network_count,allowempty"`
// 距离前天0点新增云主机数量
// example: 0
GuestIncrementCount int `json:"guest_increment_count,allowempty"`
}
type CloudregionInfo struct {
// 区域的名称
// example: Default
Region string `json:"region"`
// 区域的Id
// example: default
RegionId string `json:"region_id"`
// 纳管云区域的组合Id(平台+Id)
// example: ZStack/59e7bc87-a6b3-4c39-8f02-c68e8243d4e4
RegionExternalId string `json:"region_external_id"`
// 纳管云区域的Id
// example: 59e7bc87-a6b3-4c39-8f02-c68e8243d4e4
RegionExtId string `json:"region_ext_id"`
}

View File

@@ -214,3 +214,24 @@ type DbinstanceFilterListInput struct {
// filter by dbinstance_id
DbinstanceId string `json:"dbinstance_id" deprecated-by:"dbinstance"`
}
type DBInstanceDetails struct {
apis.VirtualResourceDetails
SDBInstance
CloudproviderInfo
// 虚拟私有网络名称
// example: test-vpc
Vpc string `json:"vpc"`
// 安全组名称
// example: Default
Secgroup string `json:"secgroup"`
// iops
// example: 0
Iops int `json:"iops"`
// IP子网名称
// example: test-network
Network string `json:"network"`
// 标签信息
Metadata map[string]string `json:"metadata"`
}

View File

@@ -67,3 +67,22 @@ type DBInstanceAccountCreateInput struct {
type SDBInstanceSetPrivilegesInput struct {
Privileges []SDBInstanceAccountPrivilege `json:"privileges"`
}
type DBInstancePrivilege struct {
// 数据库名称
Database string
// 账号名称
Account string
// 数据库Id
DBInstancedatabaseId string
// 权限
Privileges string
}
type DBInstanceAccountDetails struct {
apis.StandaloneResourceDetails
SDBInstanceAccount
// 账号权限列表
DBInstanceprivileges []DBInstancePrivilege `json:"dbinstanceprivileges,allowempty"`
}

View File

@@ -42,3 +42,13 @@ type DBInstanceBackupCreateInput struct {
// swagger:ignore
ManagerId string
}
type DBInstanceBackupDetails struct {
apis.VirtualResourceDetails
SDBInstanceBackup
// RDS实例名称
DBInstance string `json:"dbinstance"`
CloudproviderInfo
}

View File

@@ -60,3 +60,11 @@ type DBInstanceDatabaseCreateInput struct {
// required: false
Accounts []SDBInstanceDatabasePrivilege `json:"accounts"`
}
type DBInstancedatabaseDetails struct {
apis.StandaloneResourceDetails
SDBInstanceDatabase
// 数据库权限
DBInstanceprivileges []DBInstancePrivilege `json:"dbinstanceprivileges"`
}

View File

@@ -15,6 +15,8 @@
package compute
import (
"time"
"yunion.io/x/onecloud/pkg/apis"
)
@@ -128,3 +130,51 @@ type DiskFilterListInput struct {
// filter by disk_id
DiskId string `json:"disk_id" deprecated-by:"disk"`
}
type SimpleGuest struct {
Name string `json:"name"`
Id string `json:"id"`
Status string `json:"status"`
}
type SimpleSnapshotPolicy struct {
RepeatWeekdays []int `json:"repeat_weekdays"`
TimePoints []int `json:"time_points"`
}
type DiskDetails struct {
apis.VirtualResourceDetails
SDisk
CloudproviderInfo
// 云平台
Provider string `json:"provider"`
// 存储名称
Storage string `json:"storage"`
// 存储类型
StorageType string `json:"storage_type"`
// 介质类型
MediumType string `json:"medium_type"`
// 所挂载的虚拟机
Guests []SimpleGuest `json:"guests"`
// 所挂载的虚拟机
Guest string `json:"guest"`
// 所挂载虚拟机的数量
GuestCount int `json:"guest_count"`
// 所挂载虚拟机状态
GuestStatus string `json:"guest_status"`
// 自动清理时间
AutoDeleteAt time.Time `json:"auto_delete_at"`
// 自动快照策略状态
SnapshotpolicyStatus string `json:"snapshotpolicy_status,allowempty"`
// 自动快照策略
Snapshotpolicies []SimpleSnapshotPolicy `json:"snapshotpolicies"`
// 手动快照数量
ManualSnapshotCount int `json:"manual_snapshot_count"`
// 最多可创建手动快照数量
MaxManualSnapshotCount int `json:"max_manual_snapshot_count"`
}

View File

@@ -0,0 +1,25 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type DynamicschedtagDetails struct {
apis.StandaloneResourceDetails
SDynamicschedtag
Schedtag string `json:"schedtag"`
ResourceType string `json:"resource_type"`
}

View File

@@ -12,22 +12,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package apis
package compute
type VirtualResourceDetails struct {
ModelBaseDetails
}
type VirtualResourceListInput struct {
StatusStandaloneResourceListInput
ProjectizedResourceListInput
// 列表中包含标记为"系统资源"的资源
System *bool `json:"system"`
// 是否显示回收站内的资源,默认不显示(对实现了回收站的资源有效,例如主机,磁盘,镜像)
PendingDelete *bool `json:"pending_delete"`
// 是否显示所有资源,包括回收站和不再回收站的资源
// TODO: fix this???
PendingDeleteAll *bool `json:"-"`
import "yunion.io/x/onecloud/pkg/apis"
type ElasticcacheDetails struct {
apis.VirtualResourceDetails
SElasticcache
CloudproviderInfo
// 虚拟私有网络名称
Vpc string `json:"vpc"`
// IP子网名称
Network string `json:"network"`
}

View File

@@ -0,0 +1,29 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type ElasticcacheBackupDetails struct {
apis.StandaloneResourceDetails
SElasticcacheBackup
CloudproviderInfo
// 引擎
Engine string `json:"engine"`
// 引擎版本
EngineVersion string `json:"engine_version"`
}

View File

@@ -0,0 +1,22 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type ElasticcacheSkuDetails struct {
apis.StandaloneResourceDetails
SElasticcacheSku
}

View File

@@ -67,3 +67,13 @@ type SElasticipCreateInput struct {
// swagger:ignore
NetworkId string
}
type ElasticipDetails struct {
apis.VirtualResourceDetails
SElasticip
CloudproviderInfo
// 绑定资源名称
AssociateName string `json:"associate_name"`
}

View File

@@ -0,0 +1,26 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type ExternalProjectDetails struct {
apis.StandaloneResourceDetails
SExternalProject
CloudproviderInfo
Tenant string `json:"tenant"`
}

View File

@@ -21,3 +21,8 @@ import (
type GlobalVpcCreateInput struct {
apis.EnabledStatusStandaloneResourceCreateInput
}
type GlobalVpcDetails struct {
apis.StandaloneResourceDetails
SGlobalVpc
}

View File

@@ -0,0 +1,29 @@
// 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.
package compute
import (
"yunion.io/x/onecloud/pkg/apis"
)
type GroupguestDetails struct {
apis.JoinModelBaseDetails
Instancegroup string
Server string
Guest string
SGroupguest
}

View File

@@ -0,0 +1,29 @@
// 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.
package compute
import (
"yunion.io/x/onecloud/pkg/apis"
)
type GroupnetworkDetails struct {
apis.JoinModelBaseDetails
SGroupnetwork
// 主机组名称
Instancegroup string
// IP子网名称
Network string
}

View File

@@ -0,0 +1,45 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type GuestDiskDetails struct {
apis.JoinModelBaseDetails
SGuestdisk
// 云主机名称
Guest string
// 云主机名称
Server string
// 磁盘名称
Disk string
// 存储类型
// example: local
StorageType string `json:"storage_type"`
// 磁盘大小, 单位Mb
// example: 10240
DiskSize int `json:"disk_size"`
// 磁盘状态
// example: ready
Status string `json:"status"`
// 磁盘类型
// example: data
DiskType string `json:"disk_type"`
// 介质类型
// example: ssd
MediumType string `json:"medium_type"`
}

View File

@@ -0,0 +1,29 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type GuestnetworkDetails struct {
apis.JoinModelBaseDetails
SGuestnetwork
// 云主机名称
Guest string
// 云主机名称
Server string
// IP子网名称
Network string
}

View File

@@ -15,6 +15,10 @@
package compute
import (
"time"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
)
@@ -123,3 +127,51 @@ func (i ServerRebuildRootInput) GetKeypairName() string {
type ServerResumeInput struct {
apis.Meta
}
type ServerDetails struct {
apis.VirtualResourceDetails
SGuest
CloudproviderInfo
// details
// 网络概要
Networks string `json:"networks"`
// 磁盘概要
Disks string `json:"disks"`
// 磁盘详情
DisksInfo *jsonutils.JSONArray `json:"disk_info"`
// 虚拟机Ip列表
VirtualIps string `json:"virtual_ips"`
// 安全组规则
SecurityRules string `json:"security_rules"`
// 操作系统名称
OsName string `json:"os_name"`
// 操作系统类型
OsType string `json:"os_type"`
// 系统管理员可见的安全组规则
AdminSecurityRules string `json:"admin_security_rules"`
// list
AttachTime time.Time `attach_time`
// common
IsPrepaidRecycle bool `json:"is_prepaid_recycle"`
// 备机所在宿主机名称
BackupHostName string `json:"backup_host_name"`
// 北京所在宿主机状态
BackupHostStatus string `json:"backup_host_status"`
// 宿主机名称
Host string `json:"host"`
// 宿主机SN
HostSN string `json:"host_sn"`
CanRecycle bool `json:"can_recycle"`
// 自动释放时间
AutoDeleteAt time.Time `json:"auto_delete_at"`
// 标签
Metadata map[string]string `json:"metadata"`
// 磁盘数量
DiskCount int `json:"disk_count"`
// 是否支持ISO启动
CdromSupport bool `json:"cdrom_support"`
}

View File

@@ -36,7 +36,6 @@ type GuesttemplateCreateInput struct {
}
type GuesttemplateDetails struct {
apis.Meta
apis.SharableVirtualResourceDetails
SGuestTemplate

View File

@@ -15,6 +15,8 @@
package compute
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
)
@@ -69,3 +71,53 @@ type HostListInput struct {
// filter host that is baremetal
Baremetal *bool `json:"baremetal"`
}
type HostDetails struct {
apis.StandaloneResourceDetails
SHost
CloudproviderInfo
Schedtags []SchedtagShortDescDetails `json:"schedtags"`
ServerId string `json:"server_id"`
Server string `json:"server"`
ServerIps string `json:"server_ips"`
// 网卡数量
NicCount int `json:"nic_count"`
// 网卡详情
NicInfo []jsonutils.JSONObject `json:"nic_info"`
// CPU超分比
CpuCommit int `json:"cpu_commit"`
// 内存超分比
MemCommit int `json:"mem_commit"`
// 云主机数量
// example: 10
Guests int `json:"guests"`
// 非系统云主机数量
// example: 0
NonsystemGuests int `json:"nonsystem_guests"`
// 运行中云主机数量
// example: 2
RunningGuests int `json:"running_geusts"`
// CPU超分率
CpuCommitRate float64 `json:"cpu_commit_rate"`
// 内存超分率
MemCommitRate float64 `json:"mem_commit_rate"`
// 存储大小
Storage int64 `json:"storage"`
// 已使用存储大小
StorageUsed int64 `json:"storage_used"`
// 浪费存储大小(异常磁盘存储大小)
StorageWaste int64 `json:"storage_waste"`
// 虚拟存储大小
StorageVirtual int64 `json:"storage_virtual"`
// 可用存储大小
StorageFree int64 `json:"storage_free"`
// 存储超分率
StorageCommitRate float64 `json:"storage_commit_rate"`
Spec *jsonutils.JSONDict `json:"spec"`
IsPrepaidRecycle bool `json:"is_prepaid_recycle"`
CanPrepare bool `json:"can_prepare"`
PrepareFailReason string `json:"prepare_fail_reason"`
}

View File

@@ -0,0 +1,22 @@
// 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.
package compute
type HostJointsDetails struct {
// 宿主机名称
Host string `json:"host"`
// 裸金属服务器名称
Baremetal string `json:"baremetal"`
}

View File

@@ -0,0 +1,28 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type HostnetworkDetails struct {
apis.JoinModelBaseDetails
HostJointsDetails
SHostwire
// IP子网名称
Network string `json:"network"`
NicType string `json:"nic_type"`
}

View File

@@ -0,0 +1,25 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type HostschedtagDetails struct {
apis.JoinModelBaseDetails
HostJointsDetails
SHostschedtag
Schedtag string `json:"string"`
}

View File

@@ -0,0 +1,57 @@
// 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.
package compute
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
)
type HoststorageDetails struct {
apis.JoinModelBaseDetails
HostJointsDetails
SHoststorage
// 存储名称
Storage string `json:"storage"`
// 存储大小
Capacity int64 `json:"capacity"`
// 存储配置信息
StorageConf jsonutils.JSONObject `json:"storage_conf"`
// 已使用存储大小
UsedCapacity int64 `json:"used_capacity"`
// 浪费存储大小(异常磁盘总大小)
WasteCapacity int64 `json:"waste_capacity"`
// 可用存储大小
FreeCapacity int64 `json:"free_capacity"`
// 存储类型
// example: local
StorageType string `json:"storage_type"`
// 介质类型
// example: ssd
MediumType string `json:"medium_type"`
// 是否启用
Enabled bool `json:"enabled"`
// 超售比
Cmtbound float32 `json:"cmtbound"`
// 镜像缓存路径
ImagecachePath string `json:"imagecache_path"`
// 存储缓存Id
StoragecacheId string `json:"storagecached_id"`
GuestDiskCount int `json:"guest_disk_count,allowempty"`
}

View File

@@ -0,0 +1,29 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type HostwireDetails struct {
apis.JoinModelBaseDetails
HostJointsDetails
SHostwire
// 二层网络名称
Wire string `json:"wire"`
// 带宽大小
Bandwidth int `json:"bandwidth"`
}

View File

@@ -28,9 +28,11 @@ type InstanceGroupListInput struct {
}
type InstanceGroupDetail struct {
apis.Meta
apis.VirtualResourceDetails
SGroup
GuestCount int64 `json:"guest_count"`
// 云主机数量
GuestCount int `json:"guest_count"`
}
type GroupFilterListInput struct {

View File

@@ -0,0 +1,47 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type SimpleSnapshot struct {
// 快照Id
Id string `json:"id"`
// 快照名称
Name string `json:"name"`
// 存储Id
StorageId string `json:"storage_id"`
// 磁盘类型
DiskType string `json:"disk_type"`
// 区域Id
CloudregionId string `json:"cloudregion_id"`
}
type InstnaceSnapshotDetails struct {
apis.VirtualResourceDetails
SInstanceSnapshot
// 云主机状态
GuestStatus string `json:"guest_status"`
// 云主机名称
Guest string `json:"guest"`
// 存储类型
StorageType string `json:"storage_type"`
// 快照列表
Snapshots []SimpleSnapshot `json:"snapshots"`
Properties map[string]string `json:"properties"`
}

View File

@@ -0,0 +1,29 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type IsolateDeviceDetails struct {
apis.StandaloneResourceDetails
SIsolatedDevice
// 宿主机名称
Host string `json:"host"`
// 云主机名称
Guest string `json:"guest"`
// 云主机状态
GuestStatus string `json:"guest_status"`
}

View File

@@ -40,3 +40,18 @@ type KeypairCreateInput struct {
// default: RSA
Scheme string `json:"scheme"`
}
type KeypairDetails struct {
apis.StandaloneResourceDetails
SKeypair
// 私钥长度
PrivateKeyLen int `json:"private_key_len"`
// 关联云主机次数
LinkedGuestCount int `json:"linked_guest_count"`
// 用户Id
OwnerId string `json:"owner_id"`
// 用户名称
OwnerName string `json:"owner_name"`
}

View File

@@ -114,3 +114,20 @@ type LoadbalancerClusterListInput struct {
type LoadbalancerAclListInput struct {
apis.SharableVirtualResourceListInput
}
type LoadbalancerDetails struct {
apis.VirtualResourceDetails
SLoadbalancer
CloudproviderInfo
// 公网IP地址
Eip string `json:"eip"`
// 公网IP地址类型: 弹性、非弹性
// example: public_ip
EipMode string `json:"eip_mode"`
// 虚拟私有网络名称
Vpc string `json:"vpc"`
// 后端服务器组名称
BackendGroup string `json:"backend_group"`
}

View File

@@ -0,0 +1,22 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type LoadbalancerAclDetails struct {
apis.SharableVirtualResourceDetails
SLoadbalancerAcl
}

View File

@@ -0,0 +1,25 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type LoadbalancerAgentDetails struct {
apis.StandaloneResourceDetails
SLoadbalancerAgent
ZoneInfo ZoneInfo
Cluster string `json:"cluster"`
}

View File

@@ -0,0 +1,26 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type LoadbalancerBackendDetails struct {
apis.VirtualResourceDetails
SLoadbalancerBackend
CloudproviderInfo
VpcId string `json:"vpc_id"`
}

View File

@@ -0,0 +1,25 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type LoadbalancerBackendGroupDetails struct {
apis.VirtualResourceDetails
SLoadbalancerBackendGroup
Loadbalancer string `json:"loadbalancer"`
CloudregionInfo
}

View File

@@ -0,0 +1,22 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type LoadbalancerCertificateDetails struct {
apis.VirtualResourceDetails
SLoadbalancerCertificate
}

View File

@@ -0,0 +1,24 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type LoadbalancerCusterDetails struct {
apis.StandaloneResourceDetails
SLoadbalancerCluster
ZoneInfo
}

View File

@@ -0,0 +1,30 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type LoadbalancerListenerDetails struct {
apis.VirtualResourceDetails
SLoadbalancerListener
BackendGroup string `json:"backend_group"`
Loadbalancer string `json:"loadbalancer"`
AclName string `json:"acl_name"`
CertificateName string `json:"certificate_name"`
OriginCertificateId string `json:"origin_certificate_id"`
CloudregionInfo
}

View File

@@ -0,0 +1,26 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type LoadbalancerListenerRuleDetails struct {
apis.VirtualResourceDetails
SLoadbalancerListenerRule
BackendGroup string `json:"backend_group"`
CloudregionInfo
}

View File

@@ -0,0 +1,27 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type LoadbalancernetworkDetails struct {
apis.JoinModelBaseDetails
SLoadbalancerNetwork
// 负载均衡器名称
Loadbalancer string `json:"loadbalancer"`
// IP子网名称
Network string `json:"network"`
}

View File

@@ -39,3 +39,35 @@ type SNatDCreateInput struct {
ExternalPort int
IpProtocol string
}
type NatDEntryDetails struct {
apis.StandaloneResourceDetails
// SNatDEntry
Natgateway string `json:"natgateway"`
RealName string `json:"real_name"`
}
type NatSEntryDetails struct {
apis.StandaloneResourceDetails
// SNatSEntry
Natgateway string `json:"natgateway"`
RealName string `json:"real_name"`
Network SimpleNetwork `json:"network"`
}
type SimpleNetwork struct {
Id string `json:"id"`
Name string `json:"name"`
}
type NatgatewayDetails struct {
apis.StandaloneResourceDetails
SNatGateway
CloudproviderInfo
Vpc string `json:"vpc"`
NatSpec string `json:"nat_spec"`
}

View File

@@ -115,25 +115,38 @@ type NetworkCreateInput struct {
}
type NetworkDetails struct {
apis.Meta
apis.SharableVirtualResourceDetails
CloudproviderDetails
CloudproviderInfo
SNetwork
Wire string `json:"wire"`
Exit bool `json:"exit"`
Ports int `json:"ports"`
PortsUsed int `json:"ports_used"`
Vnics int `json:"vnics"`
BmVnics int `json:"bm_nics"`
LbVnics int `json:"lb_vnics"`
EipVnics int `json:"eip_vnics"`
GroupVnics int `json:"group_vnics"`
ReserveVnics int `json:"reserve_vnics"`
Vpc string `json:"vpc"`
VpcId string `json:"vpc_id"`
VpcExtId string `json:"vpc_ext_id"`
// 二层网络名称
Wire string `json:"wire"`
// 是否是内网
Exit bool `json:"exit"`
// 端口数量
Ports int `json:"ports"`
// 已使用端口数量
PortsUsed int `json:"ports_used"`
// 网卡数量
Vnics int `json:"vnics"`
// 裸金属网卡数量
BmVnics int `json:"bm_nics"`
// 负载均衡网卡数量
LbVnics int `json:"lb_vnics"`
// 浮动Ip网卡数量
EipVnics int `json:"eip_vnics"`
GroupVnics int `json:"group_vnics"`
// 预留IP数量
ReserveVnics int `json:"reserve_vnics"`
// 虚拟私有网络名称
Vpc string `json:"vpc"`
// 虚拟私有网络Id
VpcId string `json:"vpc_id"`
// 虚拟私有网络外部Id
VpcExtId string `json:"vpc_ext_id"`
// 路由信息
Routes [][]string `json:"routes"`
Schedtags []SchedtagShortDescDetails `json:"schedtags"`
}

View File

@@ -0,0 +1,40 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type NetworkInterfaceNetworkInfo struct {
// Ip子网Id
NetworkId string `json:"network_id"`
// IP地址
IpAddr string `json:"ip_addr"`
// 是否是主ip地址
Primary bool `json:"primary"`
// 弹性网卡id
NetworkinterfaceId string `json:"networkinterface_id"`
// IP子网名称
Network string `json:"network"`
}
type NetworkInterfaceDetails struct {
apis.StandaloneResourceDetails
SNetworkInterface
CloudproviderInfo
// 弹性网卡网络信息
Networks []NetworkInterfaceNetworkInfo `json:"networks"`
}

View File

@@ -0,0 +1,26 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type NetworkschedtagDetails struct {
apis.JoinModelBaseDetails
SNetworkschedtag
// IP子网名称
Network string `json:"network"`
Schedtag string `json:"schedtag"`
}

View File

@@ -36,3 +36,13 @@ type ReservedipListInput struct {
// list all reserved ips, including expired ones
All *bool `json:"all"`
}
type ReservedipDetails struct {
apis.ModelBaseDetails
SReservedip
// IP子网名称
Network string `json:"network"`
// 是否过期
Expired bool `json:"expired"`
}

View File

@@ -0,0 +1,28 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type RouteTableDetails struct {
apis.VirtualResourceDetails
SRouteTable
CloudproviderInfo
// 虚拟私有网络名称
Vpc string `json:"vpc"`
// 区域名称
Cloudregion string `json:"cloudregion"`
}

View File

@@ -0,0 +1,25 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type SchedpolicyDetails struct {
apis.StandaloneResourceDetails
SSchedpolicy
Schedtag string `json:"schedtag"`
ResourceType string `json:"resource_type"`
}

View File

@@ -58,3 +58,16 @@ type SchedtagListInput struct {
// filter by type, alias for resource_type
Type string `json:"type" deprecated-by:"resource_type"`
}
type SchedtagDetails struct {
apis.StandaloneResourceDetails
SSchedtag
DynamicSchedtagCount int `json:"dynamic_schedtag_count"`
SchedpolicyCount int `json:"schedpolicy_count"`
ProjectId string `json:"project_id"`
HostCount int `json:"host_count"`
ServerCount int `json:"server_count"`
OtherCount int `json:"other_count"`
JoinModelKeyword string `json:"join_model_keyword"`
}

View File

@@ -164,3 +164,19 @@ type SecgroupFilterListInput struct {
// filter by secgroup_id
SecgroupId string `json:"secgroup_id" deprecated-by:"secgroup"`
}
type SecgroupDetails struct {
apis.SharableVirtualResourceDetails
SSecurityGroup
// 关联云主机数量
GuestCnt int `json:"guest_cnt"`
// 安全组缓存数量
CacheCnt int `json:"cache_cnt"`
// 规则信息
Rules string `json:"rules"`
// 入方向规则信息
InRules string `json:"in_rules"`
// 出方向规则信息
OutRules string `json:"out_rules"`
}

View File

@@ -0,0 +1,27 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type SecurityGroupCacheDetails struct {
apis.StandaloneResourceDetails
SSecurityGroupCache
CloudproviderInfo
// 虚拟私有网络名称
Vpc string `json:"vpc"`
}

View File

@@ -128,3 +128,23 @@ type ServerSkuCreateInput struct {
// swagger:ignore
Provider string
}
type ServerSkuDetails struct {
apis.StandaloneResourceDetails
SServerSku
// 绑定云主机数量
TotalGuestCount int `json:"total_guest_count"`
// 可用区名称
Zone string `json:"zone"`
// 可用区外部Id
ZoneExtId string `json:"zone_ext_id"`
// 区域名称
Region string `json:"region"`
// 区域Id
RegionId string `json:"region_id"`
// 区域外部Id
RegionExternalId string `json:"region_external_id"`
// 区域外部Id(不携带平台信息)
RegionExtId string `json:"region_ext_id"`
}

View File

@@ -86,3 +86,25 @@ type InstanceSnapshotListInput struct {
ServerFilterListInput
}
type SnapshotDetails struct {
apis.VirtualResourceDetails
SSnapshot
CloudproviderInfo
// 存储类型
StorageType string `json:"storage_type"`
// 磁盘状态
DiskStatus string `json:"disk_status"`
// 云主机名称
Guest string `json:"guest"`
// 云主机Id
GuestId string `json:"guest_id"`
// 云主机状态
GuestStatus string `json:"guest_status"`
// 磁盘名称
DiskName string `json:"disk_name"`
// 是否是子快照
IsSubSnapshot bool `json:"is_sub_snapshot,allowempty"`
}

View File

@@ -0,0 +1,29 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type SnapshotPolicyDetails struct {
apis.VirtualResourceDetails
//SSnapshotPolicy
apis.SVirtualResourceBase
RetentionDays int `json:"retention_days"`
RepeatWeekdays []int `json:"repeat_weekdays"`
TimePoints []int `json:"time_points"`
IsActivated *bool `json:"is_activated,omitempty"`
BindingDiskCount int `json:"binding_disk_count"`
}

View File

@@ -0,0 +1,24 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type SnapshotPolicyCacheDetails struct {
apis.StandaloneResourceDetails
SSnapshotPolicyCache
CloudproviderInfo
}

View File

@@ -0,0 +1,27 @@
// 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.
package compute
import (
"yunion.io/x/onecloud/pkg/apis"
)
type SnapshotPolicyDiskDetails struct {
apis.JoinModelBaseDetails
// 快照策略名称
Snapshotpolicy string `json:"snapshotpolicy"`
Disk DiskDetails `json:"disk"`
}

View File

@@ -111,3 +111,27 @@ type StorageCreateInput struct {
// example: /nfs_root/
NfsSharedDir string `json:"nfs_shared_dir"`
}
type StorageDetails struct {
apis.StandaloneResourceDetails
SStorage
// 容量大小, 单位Mb
Capacity int64 `json:"capacity"`
// 已使用容量大小
Used int64 `json:"used"`
// 浪费容量大小(异常磁盘大小总和)
Wasted int64 `json:"wasted"`
// 虚拟容量大小
VCapacity int64 `json:"vcapacity"`
// 超分率
CommitRate float64 `json:"commit_rate"`
// 可使用容量
FreeCapacity int64 `json:"free_capacity"`
CloudproviderInfo
Schedtags []SchedtagShortDescDetails `json:"schedtags"`
// 超分比
CommitBound float32 `json:"commit_bound"`
}

View File

@@ -0,0 +1,35 @@
// 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.
package compute
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
)
type StoragecacheDetails struct {
apis.StandaloneResourceDetails
SStoragecache
// 存储列表
Storages []string `json:"storages"`
// 缓存镜像总大小
Size int64 `json:"size"`
// 缓存镜像个数
Count int `json:"count"`
// 通过一致性哈希获取的一个管理宿主机信息
Host *jsonutils.JSONDict `json:"host"`
}

View File

@@ -0,0 +1,41 @@
// 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.
package compute
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
)
type StoragecachedimageDetails struct {
apis.JoinModelBaseDetails
// 存储缓存名称
Storagecache string `json:"storagecache"`
// 缓存镜像名称
Cachedimage string `json:"cachedimage"`
// 存储列表
Storages []string `json:"storages"`
// 通过一致性哈希获取的一个宿主机详情
Host *jsonutils.JSONDict `json:"host"`
// 镜像名称
Image string `json:"image"`
// 镜像大小
Size int64 `json:"size"`
// 引用次数
Reference int `json:"reference"`
}

View File

@@ -0,0 +1,26 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type StorageschedtagDetails struct {
apis.JoinModelBaseDetails
SStorageschedtag
// 存储名称
Storage string `json:"storage"`
Schedtag string `json:"schedtag"`
}

36
pkg/apis/compute/vpc.go Normal file
View File

@@ -0,0 +1,36 @@
// 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.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type VpcDetails struct {
apis.StandaloneResourceDetails
SVpc
CloudproviderInfo
// 二层网络数量
// example: 1
WireCount int `json:"wire_count"`
// IP子网个数
// example: 2
NetworkCount int `json:"network_count"`
// 路由表个数
// example: 0
RoutetableCount int `json:"routetable_count"`
// NAT网关个数
// example: 0
NatgatewayCount int `json:"natgateway_count"`
}

View File

@@ -41,3 +41,21 @@ type WireCreateInput struct {
// swagger:ignore
ZoneId string
}
type WireDetails struct {
apis.StandaloneResourceDetails
SWire
// 可用区Id
// exampe: zone1
Zone string `json:"zone"`
// IP子网数量
// example: 1
Networks int `json:"networks"`
// VPC名称
Vpc string `json:"vpc'`
// VPC外部Id
VpcExtId string `json:"vpc_ext_id"`
CloudproviderInfo
}

View File

@@ -29,3 +29,52 @@ type ZoneCreateInput struct {
// swagger:ignore
CloudregionId string
}
type ZoneDetails struct {
apis.StandaloneResourceDetails
SZone
// 区域名称
Cloudregion string `json:"cloudregion"`
// 平台
// example: OneCloud
Provider string `json:"provider"`
// 可用区底下的宿主机数量
// example: 3
Hosts int `json:"hosts"`
// 可用区底下启用的宿主机数量
// example: 2
HostsEnabled int `json:"host_enabled"`
// 可用区底下的裸金属服务器数量
// example: 1
Baremetals int `json:"baremetals"`
// 可用区底下启用的裸金属服务器数量
// example: 1
BaremetalsEnabled int `json:"baremetals_enabled"`
// 可用区底下的二层网络数量
// example: 3
Wires int `json:"wires"`
// 可用区底下的子网数量
// example: 1
Networks int `json:"networks"`
// 可用区底下的块存储数量
// example: 1
Storages int `json:"storages"`
}
type ZoneInfo struct {
// 可用区名称
// example: zone1
Zone string `json:"zone"`
// 纳管云的zoneId
ZoneExtId string `json:"zone_ext_id"`
CloudregionInfo
}

View File

@@ -0,0 +1,27 @@
// 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.
package identity
import "yunion.io/x/onecloud/pkg/apis"
type CredentialDetails struct {
apis.StandaloneResourceDetails
SCredential
Blob string `json:"blob"`
User string `json:"user"`
Domain string `json:"domain"`
DomainId string `json:"domain_id"`
}

View File

@@ -0,0 +1,29 @@
// 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.
package identity
import "yunion.io/x/onecloud/pkg/apis"
type DomainDetails struct {
apis.StandaloneResourceDetails
SDomain
UserCout int `json:"user_count"`
GroupCount int `json:"group_count"`
ProjectCout int `json:"project_count"`
RoleCount int `json:"role_count"`
PolicyCount int `json:"policy_count"`
IdpCount int `json:"idp_count"`
}

View File

@@ -0,0 +1,22 @@
// 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.
package identity
import "yunion.io/x/onecloud/pkg/apis"
type EndpointDetails struct {
apis.StandaloneResourceDetails
SEndpoint
}

View File

@@ -0,0 +1,27 @@
// 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.
package identity
import "yunion.io/x/onecloud/pkg/apis"
type GroupDetails struct {
apis.StandaloneResourceDetails
SGroup
// 用户数量
UserCount int `json:"user_count"`
// 项目数量
ProjectCount int `json:"project_count"`
}

View File

@@ -0,0 +1,31 @@
// 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.
package identity
import "yunion.io/x/onecloud/pkg/apis"
type IdentityProviderDetails struct {
apis.StandaloneResourceDetails
SyncIntervalSeconds int `json:"sync_interval_seconds"`
TargetDomain string `json:"target_domain"`
RoleCount int `json:"role_count,allowempty"`
UserCount int `json:"user_count,allowempty"`
PolicyCount int `json:"policy_count,allowempty"`
DomainCount int `json:"domain_count,allowempty"`
ProjectCount int `json:"project_count,allowempty"`
GroupCount int `json:"group_count,allowempty"`
}

View File

@@ -0,0 +1,22 @@
// 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.
package identity
import "yunion.io/x/onecloud/pkg/apis"
type PolicyDetails struct {
apis.StandaloneResourceDetails
SPolicy
}

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.
package identity
import (
"time"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
)
type ProjectDetails struct {
apis.StandaloneResourceDetails
SProject
GroupCount int `json:"group_count"`
UserCount int `json:"user_count"`
ExtResource jsonutils.JSONObject `json:"ext_resource"`
ExtResourcesLastUpdate time.Time `json:"ext_resources_last_update"`
ExtResourcesNextUpdate time.Time `json:"ext_resources_next_update"`
}

View File

@@ -0,0 +1,24 @@
// 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.
package identity
import "yunion.io/x/onecloud/pkg/apis"
type RegionDetails struct {
apis.StandaloneResourceDetails
SRegion
EndpointCount int `json:"endpoint_count"`
}

27
pkg/apis/identity/role.go Normal file
View File

@@ -0,0 +1,27 @@
// 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.
package identity
import "yunion.io/x/onecloud/pkg/apis"
type RoleDetails struct {
apis.StandaloneResourceDetails
SRole
UserCount int `json:"user_count"`
GroupCount int `json:"group_count"`
ProjectCount int `json:"project_count"`
MatchPolicies []string `json:"match_policies"`
}

View File

@@ -0,0 +1,24 @@
// 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.
package identity
import "yunion.io/x/onecloud/pkg/apis"
type ServiceDetails struct {
apis.StandaloneResourceDetails
SService
EndpointCount int `json:"endpoint_count"`
}

33
pkg/apis/identity/user.go Normal file
View File

@@ -0,0 +1,33 @@
// 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.
package identity
import (
"time"
"yunion.io/x/onecloud/pkg/apis"
)
type UserDetails struct {
apis.StandaloneResourceDetails
SUser
GroupCount int `json:"group_count"`
ProjectCount int `json:"project_count"`
CredentialCount int `json:"credential_count"`
FailedAuthCount int `json:"failed_auth_count"`
FailedAuthAt time.Time `json:"failed_auth_at"`
PasswordExpiresAt time.Time `json:"password_expires_at"`
}

View File

@@ -91,6 +91,12 @@ type SFederatedUser struct {
DisplayName string `json:"display_name"`
}
// SGroup is an autogenerated struct via yunion.io/x/onecloud/pkg/keystone/models.SGroup.
type SGroup struct {
SIdentityBaseResource
Displayname string `json:"displayname"`
}
// SIdentityBaseResource is an autogenerated struct via yunion.io/x/onecloud/pkg/keystone/models.SIdentityBaseResource.
type SIdentityBaseResource struct {
apis.SStandaloneResourceBase
@@ -153,6 +159,13 @@ type SPolicy struct {
Blob interface{} `json:"blob"`
}
// SProject is an autogenerated struct via yunion.io/x/onecloud/pkg/keystone/models.SProject.
type SProject struct {
SIdentityBaseResource
ParentId string `json:"parent_id"`
IsDomain *bool `json:"is_domain,omitempty"`
}
// SRegion is an autogenerated struct via yunion.io/x/onecloud/pkg/keystone/models.SRegion.
type SRegion struct {
apis.SStandaloneResourceBase
@@ -174,6 +187,21 @@ type SService struct {
Extra interface{} `json:"extra"`
}
// SUser is an autogenerated struct via yunion.io/x/onecloud/pkg/keystone/models.SUser.
type SUser struct {
SEnabledIdentityBaseResource
Email string `json:"email"`
Mobile string `json:"mobile"`
Displayname string `json:"displayname"`
LastActiveAt time.Time `json:"last_active_at"`
LastLoginIp string `json:"last_login_ip"`
LastLoginSource string `json:"last_login_source"`
IsSystemAccount *bool `json:"is_system_account,omitempty"`
DefaultProjectId string `json:"default_project_id"`
AllowWebConsole *bool `json:"allow_web_console,omitempty"`
EnableMfa *bool `json:"enable_mfa,omitempty"`
}
// SUsergroupMembership is an autogenerated struct via yunion.io/x/onecloud/pkg/keystone/models.SUsergroupMembership.
type SUsergroupMembership struct {
apis.SResourceBase

View File

@@ -0,0 +1,39 @@
// 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.
package image
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
)
type GuestImageDetails struct {
apis.SharableVirtualResourceDetails
SGuestImage
ImageIds jsonutils.JSONObject `json:"image_ids"`
//Status string `json:"status"`
Size int64 `json:"size"`
MinRamMb int32 `json:"min_ram_mb"`
DiskFormat string `json:"disk_format"`
RootImage jsonutils.JSONObject `json:"root_image"`
DataImages jsonutils.JSONObject `json:"data_images"`
Properties *jsonutils.JSONDict `json:"properties"`
DisableDelete bool `json:"disable_delete"`
}

View File

@@ -15,6 +15,10 @@
package image
import (
"time"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
)
@@ -30,3 +34,17 @@ type ImageListInput struct {
type GuestImageListInput struct {
apis.SharableVirtualResourceListInput
}
type ImageDetails struct {
apis.SharableVirtualResourceDetails
SImage
// 镜像属性信息
Properties *jsonutils.JSONDict `json:"properties"`
// 自动清除时间
AutoDeleteAt time.Time `json:"auto_delete_at"`
// 删除保护
DisableDelete bool `json:"disable_delete"`
//OssChecksum string `json:"oss_checksum"`
}

View File

@@ -14,17 +14,6 @@
package apis
type ModelBaseDetails struct {
CanDelete bool `json:"can_delete"`
DeleteFailReason string `json:"delete_fail_reason"`
CanUpdate bool `json:"can_update"`
UpdateFailReason string `json:"update_fail_reason"`
}
type ModelBaseShortDescDetail struct {
ResName string `json:"res_name"`
}
type ModelBaseListInput struct {
Meta
@@ -88,3 +77,76 @@ type IncrementalListInput struct {
// 用于指定增量加载的标记
PagingMarker string `json:"paging_marker"`
}
type VirtualResourceListInput struct {
StatusStandaloneResourceListInput
ProjectizedResourceListInput
// 列表中包含标记为"系统资源"的资源
System *bool `json:"system"`
// 是否显示回收站内的资源,默认不显示(对实现了回收站的资源有效,例如主机,磁盘,镜像)
PendingDelete *bool `json:"pending_delete"`
// 是否显示所有资源,包括回收站和不再回收站的资源
// TODO: fix this???
PendingDeleteAll *bool `json:"-"`
}
type ResourceBaseListInput struct {
ModelBaseListInput
}
type SharableResourceListInput struct {
// 根据资源是否共享过滤列表
IsPublic *bool `json:"is_public"`
}
type SharableVirtualResourceListInput struct {
VirtualResourceListInput
// 根据资源的共享范围过滤列表可能值为system, domain, project
PublicScope string `json:"public_scope"`
}
type AdminSharableVirtualResourceListInput struct {
SharableVirtualResourceListInput
}
type STag struct {
// 标签key
Key string
// 标签Value
Value string
}
type StandaloneResourceListInput struct {
ResourceBaseListInput
// 通过标签过滤
Tags []STag `json:"tags"`
// 返回资源的标签不包含特定的用户标签
WithoutUserMeta bool `json:"without_user_meta"`
// 返回列表数据中包含资源的标签数据Metadata
WithMeta *bool `json:"with_meta"`
// 显示所有的资源,包括模拟的资源
ShowEmulated *bool `json:"show_emulated"`
// 以资源名称过滤列表
Names []string `json:"name"`
// 以资源ID过滤列表
Ids []string `json:"id"`
}
type StatusStandaloneResourceListInput struct {
StandaloneResourceListInput
// 以资源的状态过滤列表
Status []string `json:"status"`
}
type EnabledStatusStandaloneResourceListInput struct {
StatusStandaloneResourceListInput
// 以资源是否启用/禁用过滤列表
Enabled *bool `json:"enabled"`
}

View File

@@ -0,0 +1,25 @@
// 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.
package notify
import "yunion.io/x/onecloud/pkg/apis"
type ContactDetails struct {
apis.ModelBaseDetails
Id string `json:"id"`
Name string `json:"name"`
Details string `json:"details"`
}

View File

@@ -12,8 +12,4 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package apis
type ResourceBaseListInput struct {
ModelBaseListInput
}
package notify // import "yunion.io/x/onecloud/pkg/apis/notify"

View File

@@ -12,30 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package apis
package notify
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
)
type NotificationDetails struct {
apis.ModelBaseDetails
type SharedProject struct {
Id string `json:"id"`
Name string `json:"name"`
}
type SharableVirtualResourceDetails struct {
SharedProjects []SharedProject `json:"shared_projects"`
VirtualResourceDetails
}
type SharableResourceListInput struct {
// 根据资源是否共享过滤列表
IsPublic *bool `json:"is_public"`
}
type SharableVirtualResourceListInput struct {
VirtualResourceListInput
// 根据资源的共享范围过滤列表可能值为system, domain, project
PublicScope string `json:"public_scope"`
}
type AdminSharableVirtualResourceListInput struct {
SharableVirtualResourceListInput
UserList jsonutils.JSONObject `json:"user_list"`
}

15
pkg/apis/notify/notify.go Normal file
View File

@@ -0,0 +1,15 @@
// 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.
package notify

67
pkg/apis/output.go Normal file
View File

@@ -0,0 +1,67 @@
// 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.
package apis
type ModelBaseDetails struct {
Meta
// 资源是否可以删除, 若为flase, delete_fail_reason会返回不能删除的原因
// example: true
CanDelete bool `json:"can_delete"`
// 资源不能删除的原因
DeleteFailReason string `json:"delete_fail_reason"`
// 资源是否可以更新, 若为false,update_fail_reason会返回资源不能删除的原因
// example: true
CanUpdate bool `json:"can_update"`
// 资源不能删除的原因
UpdateFailReason string `json:"update_fail_reason"`
}
type JoinModelBaseDetails struct {
ModelBaseDetails
}
type ModelBaseShortDescDetail struct {
ResName string `json:"res_name"`
}
type SharedProject struct {
Id string `json:"id"`
Name string `json:"name"`
}
type SharableVirtualResourceDetails struct {
VirtualResourceDetails
SharedProjects []SharedProject `json:"shared_projects"`
}
type StandaloneResourceShortDescDetail struct {
ModelBaseShortDescDetail
Id string `json:"id"`
Name string `json:"name"`
}
type VirtualResourceDetails struct {
StandaloneResourceDetails
}
type StandaloneResourceDetails struct {
ModelBaseDetails
}

View File

@@ -1,61 +0,0 @@
// 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.
package apis
type StandaloneResourceShortDescDetail struct {
ModelBaseShortDescDetail
Id string `json:"id"`
Name string `json:"name"`
}
type STag struct {
// 标签key
Key string
// 标签Value
Value string
}
type StandaloneResourceListInput struct {
ResourceBaseListInput
// 通过标签过滤
Tags []STag `json:"tags"`
// 返回资源的标签不包含特定的用户标签
WithoutUserMeta bool `json:"without_user_meta"`
// 返回列表数据中包含资源的标签数据Metadata
WithMeta *bool `json:"with_meta"`
// 显示所有的资源,包括模拟的资源
ShowEmulated *bool `json:"show_emulated"`
// 以资源名称过滤列表
Names []string `json:"name"`
// 以资源ID过滤列表
Ids []string `json:"id"`
}
type StatusStandaloneResourceListInput struct {
StandaloneResourceListInput
// 以资源的状态过滤列表
Status []string `json:"status"`
}
type EnabledStatusStandaloneResourceListInput struct {
StatusStandaloneResourceListInput
// 以资源是否启用/禁用过滤列表
Enabled *bool `json:"enabled"`
}

View File

@@ -172,8 +172,8 @@ func ListItemFilter(manager IModelManager, ctx context.Context, q *sqlchemy.SQue
return ret[0].Interface().(*sqlchemy.SQuery), nil
}
func GetExtraDetails(model IModel, ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*jsonutils.JSONDict, error) {
ret, err := call(model, "GetExtraDetails", ctx, userCred, query)
func GetExtraDetails(model IModel, ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, details bool) (*jsonutils.JSONDict, error) {
ret, err := call(model, "GetExtraDetails", ctx, userCred, query, details)
if err != nil {
return nil, httperrors.NewGeneralError(err)
}

View File

@@ -1,46 +0,0 @@
// 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.
package db
import (
"reflect"
"strings"
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/utils"
)
func FetchModelExtraCountProperties(model IModel, extra *jsonutils.JSONDict) *jsonutils.JSONDict {
selfValue := reflect.ValueOf(model)
selfType := reflect.TypeOf(model)
for i := 0; i < selfValue.NumMethod(); i += 1 {
methodValue := selfValue.Method(i)
methodType := methodValue.Type()
if methodType.NumIn() != 0 || methodType.NumOut() != 2 {
continue
}
methodName := selfType.Method(i).Name
tokens := utils.CamelSplitTokens(methodName)
if len(tokens) < 3 {
continue
}
if strings.EqualFold(tokens[0], "get") && strings.EqualFold(tokens[len(tokens)-1], "count") {
resName := strings.ToLower(strings.Join(tokens[1:], "_"))
outs := methodValue.Call([]reflect.Value{})
extra.Add(jsonutils.NewInt(outs[0].Int()), resName)
}
}
return extra
}

View File

@@ -30,6 +30,7 @@ import (
"yunion.io/x/pkg/utils"
"yunion.io/x/sqlchemy"
"yunion.io/x/onecloud/pkg/apis"
"yunion.io/x/onecloud/pkg/appsrv"
"yunion.io/x/onecloud/pkg/appsrv/dispatcher"
"yunion.io/x/onecloud/pkg/cloudcommon/consts"
@@ -375,7 +376,7 @@ func Query2List(manager IModelManager, ctx context.Context, userCred mcclient.To
jsonDict = jsonDict.CopyIncludes([]string(listF)...)
jsonDict.Update(extraData)
if showDetails && !query.Contains("export_keys") {
extraDict := item.GetCustomizeColumns(ctx, userCred, query)
extraDict, _ := GetExtraDetails(item, ctx, userCred, query, false)
if extraDict != nil {
// Fix for Now
extraDict.Update(jsonDict)
@@ -709,22 +710,22 @@ func (dispatcher *DBModelDispatcher) List(ctx context.Context, query jsonutils.J
return items, nil
}
func getModelExtraDetails(item IModel, ctx context.Context, extra *jsonutils.JSONDict) *jsonutils.JSONDict {
func getModelExtraDetails(item IModel, ctx context.Context) apis.ModelBaseDetails {
out := apis.ModelBaseDetails{
CanDelete: true,
CanUpdate: true,
}
err := item.ValidateDeleteCondition(ctx)
if err != nil {
extra.Add(jsonutils.JSONFalse, "can_delete")
extra.Add(jsonutils.NewString(err.Error()), "delete_fail_reason")
} else {
extra.Add(jsonutils.JSONTrue, "can_delete")
out.CanDelete = false
out.DeleteFailReason = err.Error()
}
err = item.ValidateUpdateCondition(ctx)
if err != nil {
extra.Add(jsonutils.JSONFalse, "can_update")
extra.Add(jsonutils.NewString(err.Error()), "update_fail_reason")
} else {
extra.Add(jsonutils.JSONTrue, "can_update")
out.CanUpdate = false
out.UpdateFailReason = err.Error()
}
return extra
return out
}
func getModelItemDetails(manager IModelManager, item IModel, ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, isHead bool) (jsonutils.JSONObject, error) {
@@ -752,7 +753,7 @@ func getModelItemDetails(manager IModelManager, item IModel, ctx context.Context
}
func getItemDetails(manager IModelManager, item IModel, ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error) {
extraDict, err := GetExtraDetails(item, ctx, userCred, query)
extraDict, err := GetExtraDetails(item, ctx, userCred, query, true)
if err != nil {
return nil, httperrors.NewGeneralError(err)
}

View File

@@ -31,6 +31,7 @@ type SDomainizedResourceBaseManager struct {
}
type SDomainizedResourceBase struct {
// 域Id
DomainId string `width:"64" charset:"ascii" default:"default" nullable:"false" index:"true" list:"user"`
}

View File

@@ -23,6 +23,7 @@ import (
)
type SExternalizedResourceBase struct {
// 外部Id, 对用公有云私有资源自身的Id
ExternalId string `width:"256" charset:"utf8" index:"true" list:"user" create:"admin_optional" update:"admin"`
}

View File

@@ -144,7 +144,7 @@ type IModel interface {
GetShortDesc(ctx context.Context) *jsonutils.JSONDict
// list hooks
GetCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict
//GetCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict
// get hooks
AllowGetDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool

View File

@@ -103,24 +103,17 @@ func (manager *SJointResourceBaseManager) AllowAttach(ctx context.Context, userC
return IsAllowCreate(rbacutils.ScopeSystem, userCred, manager)
}
func JointModelExtra(jointModel IJointModel, extra *jsonutils.JSONDict) *jsonutils.JSONDict {
func JointModelExtra(jointModel IJointModel) (string, string) {
masterName, slaveName := "", ""
master := jointModel.Master()
if master != nil {
extra.Add(jsonutils.NewString(master.GetName()), master.GetModelManager().Keyword())
alias := master.GetModelManager().Alias()
if len(alias) > 0 {
extra.Add(jsonutils.NewString(master.GetName()), alias)
}
masterName = master.GetName()
}
slave := jointModel.Slave()
if slave != nil {
extra.Add(jsonutils.NewString(slave.GetName()), slave.GetModelManager().Keyword())
alias := slave.GetModelManager().Alias()
if len(alias) > 0 {
extra.Add(jsonutils.NewString(slave.GetName()), alias)
}
slaveName = slave.GetName()
}
return extra
return masterName, slaveName
}
func (joint *SJointResourceBase) GetJointModelManager() IJointModelManager {
@@ -213,11 +206,6 @@ func (self *SJointResourceBase) AllowDetach(ctx context.Context, userCred mcclie
}
/*
func (joint *SJointResourceBase) GetCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict {
extra := joint.SResourceBase.GetCustomizeColumns(ctx, userCred, query)
return JointModelExtra(joint, extra)
}
func (joint *SJointResourceBase) GetExtraDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict {
extra := joint.SResourceBase.GetCustomizeColumns(ctx, userCred, query)
return JointModelExtra(joint, extra)

View File

@@ -451,36 +451,13 @@ func (model *SModelBase) GetShortDescV2(ctx context.Context) *apis.ModelBaseShor
return &apis.ModelBaseShortDescDetail{ResName: model.Keyword()}
}
// list hooks
func (model *SModelBase) GetCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict {
extra := jsonutils.NewDict()
return getModelExtraDetails(model.GetIModel(), ctx, extra)
}
// get hooks
func (model *SModelBase) AllowGetDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool {
return false
}
func (model *SModelBase) GetExtraDetailsV2(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, out *apis.ModelBaseDetails) error {
out.CanDelete = true
out.CanUpdate = true
err := model.GetIModel().ValidateDeleteCondition(ctx)
if err != nil {
out.CanDelete = false
out.DeleteFailReason = err.Error()
}
err = model.GetIModel().ValidateUpdateCondition(ctx)
if err != nil {
out.CanUpdate = false
out.UpdateFailReason = err.Error()
}
return nil
}
func (model *SModelBase) GetExtraDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*jsonutils.JSONDict, error) {
extra := jsonutils.NewDict()
return getModelExtraDetails(model.GetIModel(), ctx, extra), nil
func (model *SModelBase) GetExtraDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, details bool) (apis.ModelBaseDetails, error) {
return getModelExtraDetails(model.GetIModel(), ctx), nil
}
func (model *SModelBase) GetExtraDetailsHeaders(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) map[string]string {

View File

@@ -31,6 +31,7 @@ type SProjectizedResourceBaseManager struct {
type SProjectizedResourceBase struct {
SDomainizedResourceBase
// 项目Id
ProjectId string `name:"tenant_id" width:"128" charset:"ascii" nullable:"false" index:"true" list:"user"`
}

View File

@@ -30,11 +30,16 @@ import (
type SResourceBase struct {
SModelBase
CreatedAt time.Time `nullable:"false" created_at:"true" index:"true" get:"user" list:"user"`
UpdatedAt time.Time `nullable:"false" updated_at:"true" list:"user"`
UpdateVersion int `default:"0" nullable:"false" auto_version:"true" list:"user"`
DeletedAt time.Time ``
Deleted bool `nullable:"false" default:"false" list:"admin"`
// 资源创建时间
CreatedAt time.Time `nullable:"false" created_at:"true" index:"true" get:"user" list:"user"`
// 资源更新时间
UpdatedAt time.Time `nullable:"false" updated_at:"true" list:"user"`
// 资源被更新次数
UpdateVersion int `default:"0" nullable:"false" auto_version:"true" list:"user"`
// 资源删除时间
DeletedAt time.Time ``
// 资源是否被删除
Deleted bool `nullable:"false" default:"false"`
}
type SResourceBaseManager struct {
@@ -74,17 +79,7 @@ func (model *SResourceBase) GetIResourceModel() IResourceModel {
return model.GetVirtualObject().(IResourceModel)
}
/*func (model *SResourceBase) GetCustomizeColumns(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict {
extra := model.SModelBase.GetCustomizeColumns(ctx, userCred, query)
canDelete := CanDelete(model, ctx)
if canDelete {
extra.Add(jsonutils.JSONTrue, "can_delete")
} else {
extra.Add(jsonutils.JSONFalse, "can_delete")
}
return extra
}
/*
func (model *SResourceBase) GetExtraDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) *jsonutils.JSONDict {
extra := model.SModelBase.GetExtraDetails(ctx, userCred, query)
canDelete := CanDelete(model, ctx)

Some files were not shown because too many files have changed in this diff Show More