templates

package
v0.0.0-...-63319d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(c *golangsdk.ServiceClient, opts *TemplateOpts) (string, error)

Create 新增模板信息

func Delete

func Delete(c *golangsdk.ServiceClient, id string) *golangsdk.ErrResult

Delete 删除指定ID的模板

func Update

func Update(c *golangsdk.ServiceClient, id string, opts *TemplateOpts) *golangsdk.ErrResult

Update 修改模板信息

Types

type CreateTemplateResp

type CreateTemplateResp struct {
	// 服务端返回的新添加的模板的id
	ID string `json:"id"`
}

CreateTemplateResp is the response from a Create operation.

type DiskObject

type DiskObject struct {
	// 磁盘序号,从0开始
	Index int `json:"index"`
	// 磁盘名称
	Name string `json:"name"`
	// 磁盘类型,同volumetype字段
	Disktype string `json:"disktype"`
	// 磁盘大小,单位:GB
	Size int `json:"size"`
}

DiskObject 磁盘模板

type DiskRequest

type DiskRequest struct {
	// 磁盘序号,从0开始
	Index int `json:"index" required:"true"`
	// 磁盘名称
	Name string `json:"name" required:"true"`
	// 磁盘类型,同volumetype字段
	Disktype string `json:"disktype" required:"true"`
	// 磁盘大小,单位:GB
	Size int `json:"size" required:"true"`
}

DiskRequest 磁盘模板

type EipObject

type EipObject struct {
	// 弹性公网IP类型,默认为5_bgp
	Type string `json:"type"`
	// 带宽大小,单位:Mbit/s
	BandwidthSize int `json:"bandwidth_size"`
}

EipObject 公网ip

type EipRequest

type EipRequest struct {
	// 弹性公网IP类型,默认为5_bgp
	Type string `json:"type" required:"true"`
	// 带宽大小,单位:Mbit/s
	BandwidthSize int `json:"bandwidth_size" required:"true"`
}

EipRequest 公网ip

type NicObject

type NicObject struct {
	// 子网ID,如果是自动创建,使用"autoCreate"
	Id string `json:"id"`
	// 子网名称
	Name string `json:"name"`
	// 子网网关/掩码
	Cidr string `json:"cidr"`
	// 虚拟机IP地址,如果没有这个字段,自动分配IP
	Ip string `json:"ip"`
}

NicObject 网卡资源

type NicRequest

type NicRequest struct {
	// 子网ID,如果是自动创建,使用"autoCreate"
	Id string `json:"id" required:"true"`
	// 子网名称
	Name string `json:"name" required:"true"`
	// 子网网关/掩码
	Cidr string `json:"cidr,omitempty"`
	// 虚拟机IP地址,如果没有这个字段,自动分配IP
	Ip string `json:"ip,omitempty"`
}

NicRequest 网卡资源

type SgObject

type SgObject struct {
	// 安全组ID
	Id string `json:"id"`
	// 安全组名称
	Name string `json:"name"`
}

SgObject 安全组object

type SgRequest

type SgRequest struct {
	// 安全组ID
	Id string `json:"id" required:"true"`
	// 安全组名称
	Name string `json:"name" required:"true"`
}

SgRequest 安全组object

type TemplateOpts

type TemplateOpts struct {
	// 模板名称
	Name string `json:"name" required:"true"`
	// 是否是通用模板,只有为true才能在console中显示
	IsTemplate *bool `json:"is_template" required:"true"`
	// Region信息,如 cn-north-4
	Region string `json:"region" required:"true"`
	// 项目ID
	ProjectID string `json:"projectid" required:"true"`
	// 可用区,如 cn-north-4b
	AvailabilityZone string `json:"availability_zone,omitempty"`
	// 目标端服务器名称
	TargetServerName string `json:"target_server_name,omitempty"`
	// 虚拟机规格
	Flavor string `json:"flavor,omitempty"`
	// VPC信息
	Vpc *VpcRequest `json:"vpc,omitempty"`
	// 网卡信息,支持多个网卡,如果是自动创建,只填一个,id使用“autoCreate”
	Nics []NicRequest `json:"nics,omitempty"`
	// 安全组,支持多个安全组,如果是自动创建,只填一个,id使用“autoCreate”
	SecurityGroups []SgRequest `json:"security_groups,omitempty"`
	// 公网IP信息
	PublicIP *EipRequest `json:"publicip,omitempty"`
	// 磁盘信息
	Disks []DiskRequest `json:"disk,omitempty"`
	// 磁盘类型: "SAS", "SSD", "GPSSD", "ESSD"
	VolumeType string `json:"volumetype,omitempty"`
	// 数据盘磁盘类型: "SAS", "SSD", "GPSSD", "ESSD"
	DataVolumeType string `json:"data_volume_type,omitempty"`
	// 目的端服务器密码
	ServerPassword string `json:"target_password,omitempty"`
}

TemplateOpts 创建/更新虚拟机模板

type TemplateResponse

type TemplateResponse struct {
	// 模板ID
	Id string `json:"id"`
	// 模板名称
	Name string `json:"name"`
	// 是否是通用模板,只有为true才能在console中显示
	IsTemplate string `json:"is_template"`
	// Region信息
	Region string `json:"region"`
	// 项目ID
	Projectid string `json:"projectid"`
	// 目标端服务器名称
	TargetServerName string `json:"target_server_name"`
	// 可用区
	AvailabilityZone string `json:"availability_zone"`
	// 虚拟机规格
	Flavor string `json:"flavor"`
	// VPC信息
	Vpc VpcObject `json:"vpc"`
	// 网卡信息,支持多个网卡,如果是自动创建,只填一个,id使用“autoCreate”
	Nics []NicObject `json:"nics"`
	// 安全组,支持多个安全组,如果是自动创建,只填一个,id使用“autoCreate”
	SecurityGroups []SgObject `json:"security_groups"`
	// 公网IP信息
	PublicIP EipObject `json:"publicip"`
	// 磁盘信息
	Disks []DiskObject `json:"disk"`
	// 磁盘类型: "SAS", "SSD", "GPSSD", "ESSD"
	Volumetype string `json:"volumetype"`
	// 数据盘磁盘类型: "SAS", "SSD", "GPSSD", "ESSD"
	DataVolumeType string `json:"data_volume_type"`
	// 目的端服务器密码
	ServerPassword string `json:"target_password"`
}

TemplateResponse is the response from a Get operation.

func Get

func Get(c *golangsdk.ServiceClient, id string) (*TemplateResponse, error)

Get 查询指定ID模板信息

type VpcObject

type VpcObject struct {
	// 虚拟私有云ID,如果是自动创建,填“autoCreate”
	Id string `json:"id"`
	// 虚拟私有云名称
	Name string `json:"name"`
	// VPC的网段,默认192.168.0.0/16
	Cidr string `json:"cidr"`
}

VpcObject vpc对象

type VpcRequest

type VpcRequest struct {
	// 虚拟私有云ID,如果是自动创建,填“autoCreate”
	Id string `json:"id" required:"true"`
	// 虚拟私有云名称
	Name string `json:"name" required:"true"`
	// VPC的网段,默认192.168.0.0/16
	Cidr string `json:"cidr,omitempty"`
}

VpcRequest vpc对象

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL