Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateReq ¶
type CreateReq struct {
CPU uint `json:"cpu"` // cpu
Memory uint `json:"memory"` // 内存(MB)
OS uint `json:"os"` // 操作系统ID
InBw uint `json:"in_bw"` // 进带宽(可选)
OutBw uint `json:"out_bw"` // 出带宽(可选)
IpNum uint `json:"ip_num"` // IP数量 和IP地址必须传其中一个
Ipaddress []uint `json:"ipaddress"` // IP地址ID 和IP数量必须传其中一个,节点通过IP地址分配,创建数量强制为1
Node uint `json:"node"` // 节点ID
Area uint `json:"area"` // 区域ID
Store uint `json:"store"` // 存储ID
Client uint `json:"client"` // 用户ID
SystemDiskSize uint `json:"system_disk_size"` // 系统盘大小
DataDiskSize uint `json:"data_disk_size"` // 数据盘大小(可选)
Rootpass string `json:"rootpass"` // 操作系统密码
Hostname string `json:"hostname"` // 主机名(可选)
NetworkType string `json:"network_type"` // 网络类型(normal经典网络,vpc专有网络,轻量/Hyper-V/拨号只支持normal)
Vpc uint `json:"vpc"` // vpc网络ID(当是vpc网络才有效)
VpcName string `json:"vpc_name"` // vpc网络名称(当是vpc网络没选ID才有效)
VpcIps string `json:"vpc_ips"` // vpc网络IP段(只能是192.168.0.0/16、172.16.0.0/12、10.0.0.0/8他们的子网,掩码在/16-/28,当是vpc网络没选ID才有效,v2.3.9+)
Num uint `json:"num"` // 实例数量
ClientName string `json:"client_name"` // 用户名(可选)
TrafficQuota uint `json:"traffic_quota"` // 流量限额
Port uint `json:"port"` // 端口(22,100-65535,auto=随机)
SecurityGroup uint `json:"security_group"` // 安全组ID(转发机没用,v2.3.0+)
SecurityGroupName string `json:"security_group_name"` // 新增并关联安全组的名称(如果有安全组ID优先使用安全组ID,转发机没用,批量创建且端口随机时不生效,v2.3.0+)
Type string `json:"type"` // 节点类型(host=KVM加强版,lightHost=KVM轻量,hyperv=Hyper-V,adsl=拨号云)
PasswordType uint `json:"password_type"` // 密码类型(0=密码,1=SSH密钥,windows镜像和Hyper-V节点不支持该参数)
SystemReadBytesSec int `json:"system_read_bytes_sec"` // 系统盘读取限制(MB/s)
SystemWriteBytesSec int `json:"system_write_bytes_sec"` // 系统盘写入限制(MB/s)
SystemReadIopsSec int `json:"system_read_iops_sec"` // 系统盘读取限制(ops/s)
SystemWriteIopsSec int `json:"system_write_iops_sec"` // 系统盘写入限制(ops/s)
SystemReadBytesSecMax int `json:"system_read_bytes_sec_max"` // 系统盘读取最大突发(MB)
SystemWriteBytesSecMax int `json:"system_write_bytes_sec_max"` // 系统盘写入最大突发(MB)
SystemReadIopsSecMax int `json:"system_read_iops_sec_max"` // 系统盘读取最大突发(ops)
SystemWriteIopsSecMax int `json:"system_write_iops_sec_max"` // 系统盘写入最大突发(ops)
DataReadBytesSec int `json:"data_read_bytes_sec"` // 系统盘读取限制(MB/s)
DataWriteBytesSec int `json:"data_write_bytes_sec"` // 系统盘写入限制(MB/s)
DataReadIopsSec int `json:"data_read_iops_sec"` // 系统盘读取限制(ops/s)
DataWriteIopsSec int `json:"data_write_iops_sec"` // 系统盘写入限制(ops/s)
DataReadBytesSecMax int `json:"data_read_bytes_sec_max"` // 系统盘读取最大突发(MB)
DataWriteBytesSecMax int `json:"data_write_bytes_sec_max"` // 系统盘写入最大突发(MB)
DataReadIopsSecMax int `json:"data_read_iops_sec_max"` // 系统盘读取最大突发(ops)
DataWriteIopsSecMax int `json:"data_write_iops_sec_max"` // 系统盘写入最大突发(ops)
BackupNum int `json:"backup_num"` // 备份数量(-1=不支持备份,0=不限)
SnapNum int `json:"snap_num"` // 快照数量(-1=不支持备份,0=不限)
IsNatHost int `json:"is_nat_host"` // 是否是节点转发机(0=不是,1=是)
NatAclLimit int `json:"nat_acl_limit"` // NAT转发数量(-1=不支持,0=不限)
NatWebLimit int `json:"nat_web_limit"` // NAT建站数量(-1=不支持,0=不限)
Template int `json:"template"` // 和操作系统2选1(都传优先使用操作系统) 模板ID
NodePriority int `json:"node_priority"` // 节点选择优先级(1=实例数量平均,2=负载最低,3=内存最低)
OtherDataDisk []DataDisk `json:"other_data_disk"` // 其他数据盘
LinkClone int `json:"link_clone"` // 本地系统盘创建方式(0=完整克隆,1=链接克隆,模板创建不支持该参数,v2.4.4+)
BindMac int `json:"bind_mac"` // 是否启用IP-MAC绑定(0关闭,1开启,v2.3.4+)
CpuLimit int `json:"cpu_limit"` // 跟随系统设置 cpu限制(0-100,v2.3.9+)
ResetFlowDay int `json:"reset_flow_day,omitempty"` // 流量重置日(1-31,v2.3.9+)
CpuModel int `json:"cpu_model"` // CPU模式(1=host-passthrough,2=host-model,3=custom,v2.4.4+)
Rid int `json:"rid"` // 资源包ID(前台代理商创建实例用)
DynamicMemory int `json:"dynamic_memory"` // 动态内存(0=关闭,1=开启,Hyper-V,v2.5.2+)
AdvancedCpu int `json:"advanced_cpu"` // 智能CPU规则ID
AdvancedBw int `json:"advanced_bw"` // 智能带宽规则ID
Key string `json:"key"` // 镜像设置的密钥 windows密钥
TheSamePass int `json:"the_same_pass"` // 批量创建时可以指定密码是否保持一致(0=随机,1=相同密码)
Adsl int `json:"adsl"` // ADSL账号ID(0=自动,拨号云支持)
SshKey int `json:"ssh_key"` // SSH密钥ID(有ID优先使用ID)
SshKeyName string `json:"ssh_key_name"` // SSH密钥名称(没有密钥ID时将使用密钥名称创建,password_type=1时需要ID或者名称的一种)
TrafficType int `json:"traffic_type"` // 流量统计方向(1=进,2=出,3=总计)
FloatIp struct {
Num int `json:"num"` // 浮动IP数量
InBw int `json:"in_bw"` // 浮动IP进带宽(有浮动IP数量生效)
OutBw int `json:"out_bw"` // 浮动IP出带宽(有浮动IP数量生效)
} `json:"float_ip"` //
}
type CreateResp ¶
type CreateResp struct {
Num uint `json:"num"` // 创建成功的数量
ID string `json:"id"` // 创建的实例ID
TaskID uint `json:"task_id"` // 任务ID(只有当创建1台时返回)
SecurityGroup uint `json:"security_group"` // 关联的安全组ID(只有当创建1台时返回,v2.3.0+)
Ssh struct {
ID uint `json:"id"` // 新创建的SSH密钥ID
Key uint `json:"id"` // 新创建的SSH密钥内容
} `json:"ssh"` // SSH
}
func Create ¶
func Create(ctx *cloudplatform.Context, req *CreateReq) (*CreateResp, error)
Create 创建实例
type DataDisk ¶
type DataDisk struct {
Size uint `json:"size"` // 其他磁盘大小
ReadBytesSec int `json:"read_bytes_sec"` // 读取限制(MB/s)
WriteBytesSec int `json:"write_bytes_sec"` // 写入限制(MB/s)
ReadIopsSec int `json:"read_iops_sec"` // 读取限制(ops/s)
WriteIopsSec int `json:"write_iops_sec"` // 写入限制(ops/s)
ReadBytesSecMax int `json:"read_bytes_sec_max"` // 读取最大突发(MB)
WriteBytesSecMax int `json:"write_bytes_sec_max"` // 写入最大突发(MB)
ReadIopsSecMax int `json:"read_iops_sec_max"` // 读取最大突发(ops)
WriteIopsSecMax int `json:"write_iops_sec_max"` // 写入最大突发(ops)
Store int `json:"store"` // 跟随系统盘存储ID
}
type DeleteReq ¶
type DeleteResp ¶
type DeleteResp struct {
TaskID string `json:"taskid"`
}
func Delete ¶
func Delete(ctx *cloudplatform.Context, req *DeleteReq) (*DeleteResp, error)
Delete 删除实例
type DetailResp ¶
type DetailResp struct {
Acpi int `json:"acpi"`
AdvancedBw struct {
Id int `json:"id"`
} `json:"advanced_bw"`
AdvancedCpu struct {
Id int `json:"id"`
} `json:"advanced_cpu"`
Apic int `json:"apic"`
AreaId int `json:"area_id"`
AreaName string `json:"area_name"`
BackupNum int `json:"backup_num"`
BackupUsed int `json:"backup_used"`
Bootorder string `json:"bootorder"`
BwGroup []struct {
Id int `json:"id"`
InBw int `json:"in_bw"`
OutBw int `json:"out_bw"`
} `json:"bw_group"`
ClientShowIpRemark int `json:"client_show_ip_remark"`
Clock int `json:"clock"`
Console int `json:"console"`
Cpu int `json:"cpu"`
CpuLimit string `json:"cpu_limit"`
Cpucores int `json:"cpucores"`
Cpumatch int `json:"cpumatch"`
Cpumodel int `json:"cpumodel"`
Cpunumacheck int `json:"cpunumacheck"`
Cpunumatop string `json:"cpunumatop"`
Cpusockets int `json:"cpusockets"`
Cputhreads int `json:"cputhreads"`
Cputopcheck int `json:"cputopcheck"`
Cputune string `json:"cputune"`
Cputunecheck int `json:"cputunecheck"`
CreateTime string `json:"create_time"`
CrossAreaMigrate bool `json:"cross_area_migrate"`
DefaultBwGroup struct {
Id int `json:"id"`
InBw int `json:"in_bw"`
OutBw int `json:"out_bw"`
Ip []struct {
Id int `json:"id"`
Ipaddress string `json:"ipaddress"`
SubnetMask string `json:"subnet_mask"`
Gateway string `json:"gateway"`
Remark string `json:"remark"`
} `json:"ip"`
} `json:"default_bw_group"`
Disk []struct {
Id uint `json:"id"`
Type string `json:"type"`
Size int `json:"size"`
Status int `json:"status"`
Dev string `json:"dev"`
Io string `json:"io"`
Driver string `json:"driver"`
Cache string `json:"cache"`
CreateTime string `json:"create_time"`
Name string `json:"name"`
FsType string `json:"fs_type"`
Remarks string `json:"remarks"`
ReadBytesSec int `json:"read_bytes_sec"`
WriteBytesSec int `json:"write_bytes_sec"`
ReadIopsSec int `json:"read_iops_sec"`
WriteIopsSec int `json:"write_iops_sec"`
ReadBytesSecMax int `json:"read_bytes_sec_max"`
WriteBytesSecMax int `json:"write_bytes_sec_max"`
ReadIopsSecMax int `json:"read_iops_sec_max"`
WriteIopsSecMax int `json:"write_iops_sec_max"`
StoreId uint `json:"store_id"`
IopsMin int `json:"iops_min"`
IopsMax int `json:"iops_max"`
EnableNode []string `json:"enable_node"`
StoreType string `json:"store_type"`
StoreName string `json:"store_name"`
RealDir string `json:"real_dir"`
SnapNum int `json:"snap_num"`
} `json:"disk"`
DynamicMemory int `json:"dynamic_memory"`
Gpu int `json:"gpu"`
Hostname string `json:"hostname"`
Id int `json:"id"`
ImageGroupId int `json:"image_group_id"`
Internet int `json:"internet"`
Ip []struct {
Id uint `json:"id"`
Ipaddress string `json:"ipaddress"`
Remark string `json:"remark"`
Interface int `json:"interface"`
} `json:"ip"`
IpNum int `json:"ip_num"`
IsNatHost bool `json:"is_nat_host"`
Iso []interface{} `json:"iso"`
Kvmid string `json:"kvmid"`
LinkClone int `json:"link_clone"`
LinkFile string `json:"link_file"`
LinkId int `json:"link_id"`
LinkType string `json:"link_type"`
Lock int `json:"lock"`
Mainip string `json:"mainip"`
Memory float64 `json:"memory"`
NatAclLimit int `json:"nat_acl_limit"`
NatAclUsed int `json:"nat_acl_used"`
NatWebLimit int `json:"nat_web_limit"`
NatWebUsed int `json:"nat_web_used"`
Network []struct {
Id int `json:"id"`
Mac string `json:"mac"`
Bridge string `json:"bridge"`
Niccard int `json:"niccard"`
InsideVlan string `json:"inside_vlan"`
Ipaddress []struct {
Ipaddress string `json:"ipaddress"`
} `json:"ipaddress"`
NetId int `json:"net_id"`
Vpc int `json:"vpc"`
SubnetMask string `json:"subnet_mask"`
BindMac int `json:"bind_mac"`
Bwid int `json:"bwid"`
InBw int `json:"in_bw"`
OutBw int `json:"out_bw"`
NetworkName string `json:"network_name"`
InterfaceName string `json:"interface_name"`
NetName string `json:"net_name"`
NiccardName string `json:"niccard_name"`
Name string `json:"name"`
} `json:"network"`
NetworkType string `json:"network_type"`
NodeId int `json:"node_id"`
NodeName string `json:"node_name"`
NodeVlanRange string `json:"node_vlan_range"`
OperateSystem string `json:"operate_system"`
OsName string `json:"os_name"`
Osuser string `json:"osuser"`
Pae int `json:"pae"`
PanelPass string `json:"panel_pass"`
ParentName interface{} `json:"parent_name"`
Port int `json:"port"`
Queues int `json:"queues"`
Remark string `json:"remark"`
Rescue int `json:"rescue"`
RescueSystem int `json:"rescue_system"`
ResetFlowDay int `json:"reset_flow_day"`
ResourcePackage []interface{} `json:"resource_package"`
Rid int `json:"rid"`
Rootpassword string `json:"rootpassword"`
Security int `json:"security"`
SecurityName string `json:"security_name"`
SecurityRandPortDelete bool `json:"security_rand_port_delete"`
SingleIpNat int `json:"single_ip_nat"`
SkipColdBackup int `json:"skip_cold_backup"`
SnapNum int `json:"snap_num"`
SnapUsed int `json:"snap_used"`
SshKey []interface{} `json:"ssh_key"`
Status string `json:"status"`
SupportNat int `json:"support_nat"`
SuspendType string `json:"suspend_type"`
Svg int `json:"svg"`
System int `json:"system"`
TmpTraffic int `json:"tmp_traffic"`
TrafficQuota int `json:"traffic_quota"`
TrafficStartTime string `json:"traffic_start_time"`
Trunk int `json:"trunk"`
Type string `json:"type"`
Uid int `json:"uid"`
UserId int `json:"user_id"`
Username string `json:"username"`
Uuid string `json:"uuid"`
Video int `json:"video"`
Video2D int `json:"video2d"`
Video3D int `json:"video3d"`
Vlan interface{} `json:"vlan"`
Vnc int `json:"vnc"`
Vncpass string `json:"vncpass"`
Vncport int `json:"vncport"`
VpcMac string `json:"vpc_mac"`
VpcName string `json:"vpc_name"`
Vram int `json:"vram"`
WaitRebootReason string `json:"wait_reboot_reason"`
}
func Detail ¶
func Detail(ctx *cloudplatform.Context, req *DetailReq) (*DetailResp, error)
Detail 实例列表
type ListReq ¶
type ListReq struct {
SearchType string `url:"searchtype,omitempty"` // 搜索类型,0默认搜索主机名和IP,1区域,2节点
Node string `url:"node,omitempty"` // 节点ID
Status string `url:"status,omitempty"` // 状态(init=创建中,on=开机,off=关机,suspend=暂停,paused挂起,rescue=救援系统,unknown=未知)
User string `url:"user,omitempty"` // 用户ID,后台有效
ListType string `url:"list_type,omitempty"` // 获取类型(all,page),all会忽略页数直接返回所有
ImageVersion string `url:"image_version,omitempty"` // 镜像版本id(v2.4.3+)
Security string `url:"security,omitempty"` // 安全组ID(传0可获取没有绑定安全组实例,v2.4.3+)
Vpc string `url:"vpc,omitempty"` // VPCID(v2.4.4+)
HostType string `url:"host_type,omitempty"` // 实例类型(host=专业魔方云实例,lightHost=轻量版魔方云实例,hyperv=Hyper-V,v2.5.2+)
Id string `url:"id,omitempty"` // 按ID搜索
KvmId string `url:"kvmid,omitempty"` // 按KVMID搜索
AdvancedCpu string `url:"advanced_cpu,omitempty"` // 搜索智能CPUID
AdvancedBw string `url:"advanced_bw,omitempty"` // 搜索智能带宽ID
Page string `url:"page,omitempty"`
PerPage string `url:"per_page,omitempty"`
// 排序(id,cpu,memory,hostname,node,uid,mainip,os,in_bw,out_bw,delete_time,recycle_time,cpu_usage,memory_usage,username,node_name,current_in_bw,current_out_bw,current_read_byte,current_write_byte)
Orderby string `url:"orderby,omitempty"`
Sort string `url:"sort,omitempty"`
}
type ListResp ¶
type ListResp struct {
Data []struct {
Id int `json:"id"`
Cpu int `json:"cpu"`
Memory float64 `json:"memory"`
Kvm string `json:"kvm"`
Hostname string `json:"hostname"`
Node int `json:"node"`
Status string `json:"status"`
NetworkType string `json:"network_type"`
DeleteTime string `json:"delete_time"`
RecycleTime string `json:"recycle_time"`
Rescue int `json:"rescue"`
CpuUsage string `json:"cpu_usage"`
CurrentInBw string `json:"current_in_bw"`
CurrentOutBw string `json:"current_out_bw"`
MemoryTotal string `json:"memory_total"`
MemoryUsable string `json:"memory_usable"`
MemoryUsage string `json:"memory_usage"`
Lock int `json:"lock"`
SuspendType string `json:"suspend_type"`
CurrentReadByte float64 `json:"current_read_byte"`
CurrentWriteByte float64 `json:"current_write_byte"`
NodeName string `json:"node_name"`
Type string `json:"type"`
Mainip string `json:"mainip"`
Os string `json:"os"`
Parent int `json:"parent"`
ParentName interface{} `json:"parent_name"`
Svg int `json:"svg"`
InBw int `json:"in_bw"`
OutBw int `json:"out_bw"`
Ipaddress string `json:"ipaddress"`
Remark interface{} `json:"remark"`
Rid int `json:"rid"`
ResourcePackage interface{} `json:"resource_package"`
IpNum int `json:"ip_num"`
User struct {
Id int `json:"id"`
Email string `json:"email"`
Username string `json:"username"`
Phone string `json:"phone"`
Parent int `json:"parent"`
ParentName string `json:"parent_name"`
RCount int `json:"r_count"`
} `json:"user"`
Area struct {
Id int `json:"id"`
Name string `json:"name"`
ShortName string `json:"short_name"`
} `json:"area"`
Disk []struct {
Id int `json:"id"`
Type string `json:"type"`
Size int `json:"size"`
Name string `json:"name"`
Remarks string `json:"remarks"`
Kvm int `json:"kvm"`
} `json:"disk"`
IsNatHost bool `json:"is_nat_host"`
OtherInterfaceIp string `json:"other_interface_ip"`
} `json:"data"`
Meta struct {
Total int `json:"total"`
TotalPage int `json:"total_page"`
Page int `json:"page"`
PerPage int `json:"per_page"`
} `json:"meta"`
}
type UpdateReq ¶
type UpdateReq struct {
ID uint `json:"-"` // 实例ID
CPU uint `json:"cpu,omitempty"` // CPU
Memory uint `json:"memory,omitempty"` // 内存(MB)
Vncport uint `json:"vncport,omitempty"` // vnc端口
Vncpass uint `json:"vncpass,omitempty"` // vnc密码
Vnc uint `json:"vnc,omitempty"` // 是否启用vnc(0禁用,1启用)
Bootorder string `json:"bootorder,omitempty"` // bootorder(dc,cd,d,c)
Cpumodel uint `json:"cpumodel,omitempty"` // cpumodel(1host-passthrough,2host-model,3custom)
Pae uint `json:"pae,omitempty"` // pae是否启用(0禁用,1启用)
Clock uint `json:"clock,omitempty"` // 时钟(0Default,1UTC,2Localtime)
Acpi uint `json:"acpi,omitempty"` // acpi是否启用(0禁用,1启用)
TrafficQuota uint `json:"traffic_quota,omitempty"` // 限额流量
TmpTraffic uint `json:"tmp_traffic,omitempty"` // 临时流量
TrafficType uint `json:"traffic_type,omitempty"` // 统计方向1=进2=出3=总计
SnapNum int `json:"snap_num,omitempty"` // 快照数量限制(0不限-1不允许)
BackupNum int `json:"backup_num,omitempty"` // 备份数量限制(0不限-1不允许)
NatAclLimit int `json:"nat_acl_limit,omitempty"` // nat转发限制(0不限-1不允许)
NatWebLimit int `json:"nat_web_limit,omitempty"` // nat建站限制(0不限-1不允许)
CpuTopCheck uint `json:"cputopcheck,omitempty"` // 是否启用CPUTopology(0关闭1开启)
CpuTuneCheck uint `json:"cputunecheck,omitempty"` // 是否启用CPUTune(0关闭1开启)
CpuNumaCheck uint `json:"cpunumacheck,omitempty"` // 是否启用NUMATopology(0关闭1开启)
CpuSockets uint `json:"cpusockets,omitempty"` // cpusockets
CpuCores uint `json:"cpucores,omitempty"` // cpucores
CpuThreads uint `json:"cputhreads,omitempty"` // cputhreads
CpuTune string `json:"cputune,omitempty"` // cputune
CpuNumaTop string `json:"cpunumatop,omitempty"` // cpunumatop
Console uint `json:"console,omitempty"` // console(0关闭,1开启,v2.2.7+)
ResetFlowDay uint `json:"reset_flow_day,omitempty"` // 流量重置日(只能是1-31,v2.3.9+)
Queues uint `json:"queues,omitempty"` // 网卡多队列(v2.5.2+)
DynamicMemory uint `json:"dynamic_memory,omitempty"` // 动态内存(0=关闭,1开启,v2.5.2+)
Gpu uint `json:"gpu,omitempty"` // 虚拟显存开关(0=关闭,1=开启)
VRam uint `json:"vram,omitempty"` // 虚拟显存大小(只有gpu=1时生效,单位MB,只能是16,32,64,128,256,512,1024,2048)
AdvancedCpu uint `json:"advanced_cpu,omitempty"` // 智能CPU规则
AdvancedBw uint `json:"advanced_bw,omitempty"` // 智能带宽规则
SkipColdBackup uint `json:"skip_cold_backup,omitempty"` // 是否跳过备份(0=不跳过,1=跳过冷备份)
}
type UpdateResp ¶
type UpdateResp struct{}
func Update ¶
func Update(ctx *cloudplatform.Context, req *UpdateReq) (*UpdateResp, error)
Update 修改实例
Click to show internal directories.
Click to hide internal directories.