servers

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionPowerOff

func ActionPowerOff(ctx *dcimsdk.Context, serverId uint) (resp dcimsdk.CreateUpdateResp, err error)

ActionPowerOff 关机

func ActionPowerOn

func ActionPowerOn(ctx *dcimsdk.Context, serverId uint) (resp dcimsdk.CreateUpdateResp, err error)

ActionPowerOn 开机

func ActionPowerReset

func ActionPowerReset(ctx *dcimsdk.Context, serverId uint) (resp dcimsdk.CreateUpdateResp, err error)

ActionPowerReset 重启

func ResetPwd

func ResetPwd(ctx *dcimsdk.Context, request *ResetPwdReq) (resp dcimsdk.CreateUpdateResp, err error)

ResetPwd 服务器重置系统管理员密码 https://www.eolink.com/share/inside/XIPzIs/api/1398114/detail/5775337

func Speed

func Speed(ctx *dcimsdk.Context, request *SpeedReq) (resp dcimsdk.CreateUpdateResp, err error)

func TaskStatus

func TaskStatus(ctx *dcimsdk.Context, request *TaskStatusReq) (resp dcimsdk.CreateUpdateResp, err error)

TaskStatus 服务器重装进度 https://www.eolink.com/share/inside/XIPzIs/api/1389881/detail/5779893

Types

type ActionReq

type ActionReq struct {
	ServerId uint   `json:"-"`      // 服务器id(必填)
	Action   string `json:"action"` // on(默认值) off reset
}

func (*ActionReq) Body

func (r *ActionReq) Body() (body any)

func (*ActionReq) Method

func (r *ActionReq) Method() (method string)

func (*ActionReq) Url

func (r *ActionReq) Url() (url string)

func (*ActionReq) Values

func (r *ActionReq) Values() (values url.Values)

type BmcResetReq

type BmcResetReq struct {
	ServerId int // 服务器id
}

func (*BmcResetReq) Body

func (r *BmcResetReq) Body() (body any)

func (*BmcResetReq) Method

func (r *BmcResetReq) Method() (method string)

func (*BmcResetReq) Url

func (r *BmcResetReq) Url() (url string)

func (*BmcResetReq) Values

func (r *BmcResetReq) Values() (values url.Values)

type CreateReq

type CreateReq struct {
	Name              string             `json:"name"`
	Hostname          string             `json:"hostname"`
	Datacenter        dcimsdk.OnlyIdType `json:"datacenter"`          // 数据中心信息(机房)
	Cabinet           dcimsdk.OnlyIdType `json:"cabinet"`             // 机柜信息
	Hardware          dcimsdk.OnlyIdType `json:"hardware"`            // 硬件信息
	Switch            []SwitchPort       `json:"switch,omitempty"`    // 交换机信息(必填)
	IpmiMetadata      IpMetadata         `json:"ipmi_metadata"`       // ipmi元信息
	Ipv4              []Ipv4             `json:"ipv4"`                // IP地址
	Type              string             `json:"type"`                // 类型
	Card              int                `json:"card"`                // 网卡数量
	Part              struct{}           `json:"part"`                // 组成部分
	ShelfTime         string             `json:"shelf_time"`          // 上架时间
	Gid               uint               `json:"gid,omitempty"`       // 分组id
	DisabledNetwork   int                `json:"disabled_network"`    // 是否禁用网络
	NetworkMetadata   int                `json:"network_metadata"`    // 网络元数据
	Status            string             `json:"status"`              // 状态
	Osid              string             `json:"osid"`                // 镜像名称
	Disabled          bool               `json:"disabled"`            // 禁用状态
	Username          string             `json:"username"`            // 用户名
	Password          string             `json:"password"`            // 密码
	MainMac           string             `json:"main_mac"`            // 主mac地址
	Bandwidth         int                `json:"bandwidth"`           // 带宽
	AllowRemoteSwitch bool               `json:"allow_remote_switch"` // 是否允许远程交换机
	Force             bool               `json:"force"`               // 是否强制
	DhcpEnable        int                `json:"dhcp_enable"`         // dhcp可用状态
	Unit              []int              `json:"unit"`                // 单元容量
	BladeId           string             `json:"blade_id"`            // 刀片服务器架构id
	BladeUnit         string             `json:"blade_unit"`          // 刀片单元容量
}

func (*CreateReq) Body

func (r *CreateReq) Body() (body any)

func (*CreateReq) Method

func (r *CreateReq) Method() (method string)

func (*CreateReq) Url

func (r *CreateReq) Url() (url string)

func (*CreateReq) Values

func (r *CreateReq) Values() (values url.Values)

type CreateResp

type CreateResp struct {
	Server  Server `json:"-"`
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

func Create

func Create(ctx *dcimsdk.Context, request *CreateReq) (resp CreateResp, err error)

Create 添加服务器 https://www.eolink.com/share/inside/XIPzIs/api/1389881/detail/5779927

func (CreateResp) Err

func (r CreateResp) Err() (err error)

func (CreateResp) Ok

func (r CreateResp) Ok() (ok bool)

type DeleteReq

type DeleteReq struct {
	Id uint // 服务器id
}

func (*DeleteReq) Body

func (r *DeleteReq) Body() (body any)

func (*DeleteReq) Method

func (r *DeleteReq) Method() (method string)

func (*DeleteReq) Url

func (r *DeleteReq) Url() (url string)

func (*DeleteReq) Values

func (r *DeleteReq) Values() (values url.Values)

type DetailReq

type DetailReq struct{ Id uint }

func (*DetailReq) Body

func (r *DetailReq) Body() (body any)

func (*DetailReq) Method

func (r *DetailReq) Method() (method string)

func (*DetailReq) Url

func (r *DetailReq) Url() (url string)

func (*DetailReq) Values

func (r *DetailReq) Values() (values url.Values)

type DetailResp

type DetailResp struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
	Server  struct {
		Id                 uint        `json:"id"`
		SystemSerialNumber interface{} `json:"system_serial_number"`
		Serialno           interface{} `json:"serialno"`
		Name               string      `json:"name"`
		Hostname           string      `json:"hostname"`
		Type               string      `json:"type"`
		PowerStatus        string      `json:"power_status"`
		Hardware           struct {
			Id      int    `json:"id"`
			Name    string `json:"name"`
			Size    int    `json:"size"`
			NodeNum int    `json:"node_num"`
			Row     int    `json:"row"`
		} `json:"hardware"`
		Card int `json:"card"`
		// Part struct {
		// 	CPU       []interface{} `json:"CPU"`
		// 	Mem       []interface{} `json:"内存"`
		// 	Disk      []interface{} `json:"硬盘"`
		// 	PCIDevice []interface{} `json:"PCI设备"`
		// } `json:"part"`
		Ipcount         int `json:"ipcount"`
		MainIpv4Address struct {
			Address   string `json:"address"`
			Cidr      string `json:"cidr"`
			Netmask   string `json:"netmask"`
			Gateway   string `json:"gateway"`
			IsBlock   bool   `json:"is_block"`
			Vlan      string `json:"vlan"`
			GroupName string `json:"group_name"`
		} `json:"main_ipv4address"`
		MainIpv6Address []interface{} `json:"main_ipv6address"`
		MainMac         string        `json:"main_mac"`
		IpmiMetadata    struct {
			AddressId       int    `json:"address_id"`
			Address         string `json:"address"`
			Username        string `json:"username"`
			Password        string `json:"password"`
			BlockId         int    `json:"block_id"`
			PublicBlockId   string `json:"public_block_id"`
			PublicAddressId string `json:"public_address_id"`
			PublicAddress   string `json:"public_address"`
			IpmiBlockId     int    `json:"ipmi_block_id"`
			IpmiAddressId   int    `json:"ipmi_address_id"`
			IpmiAddress     string `json:"ipmi_address"`
			Cidr            string `json:"cidr"`
		} `json:"ipmi_metadata"`
		Switch []struct {
			Id             int      `json:"id"`
			Switch         string   `json:"switch"`
			CabinetId      int      `json:"cabinet_id"`
			IsLock         int      `json:"is_lock"`
			PortName       string   `json:"port_name"`
			PortId         int      `json:"port_id"`
			MacAddress     string   `json:"mac_address"`
			Disconnected   int      `json:"disconnected"`
			Disabled       bool     `json:"disabled"`
			Type           string   `json:"type"`
			UpPort         int      `json:"up_port"`
			DownPort       int      `json:"down_port"`
			VlanType       string   `json:"vlan_type"`
			Vlans          []string `json:"vlans"`
			BindMac        int      `json:"bind_mac"`
			BindArp        int      `json:"bind_arp"`
			BindAcl        int      `json:"bind_acl"`
			PortRemark     string   `json:"port_remark"`
			HourInFlow     int      `json:"hour_in_flow"`
			HourOutFlow    int      `json:"hour_out_flow"`
			HourTotalFlow  int      `json:"hour_total_flow"`
			DayInFlow      int      `json:"day_in_flow"`
			DayOutFlow     int      `json:"day_out_flow"`
			DayTotalFlow   int      `json:"day_total_flow"`
			MonthInFlow    int      `json:"month_in_flow"`
			MonthOutFlow   int      `json:"month_out_flow"`
			MonthTotalFlow int      `json:"month_total_flow"`
			CardName       string   `json:"card_name"`
		} `json:"switch"`
		Cabinet struct {
			Id     int    `json:"id"`
			Name   string `json:"name"`
			IsLock int    `json:"is_lock"`
		} `json:"cabinet"`
		ShelfTime  string `json:"shelf_time"`
		Datacenter struct {
			Id   int    `json:"id"`
			Name string `json:"name"`
		} `json:"datacenter"`
		Username             string        `json:"username"`
		Password             string        `json:"password"`
		Remark               string        `json:"remark"`
		Image                string        `json:"image"`
		User                 []interface{} `json:"user"`
		DiskSize             int           `json:"disk_size"`
		Ipv4Blocks           []interface{} `json:"ipv4_blocks"`
		IsFree               bool          `json:"is_free"`
		Package              []interface{} `json:"package"`
		TaskId               bool          `json:"task_id"`
		RemotePort           int           `json:"remote_port"`
		Issues               []interface{} `json:"issues"`
		Intranets            []interface{} `json:"intranets"`
		IsPreinstall         int           `json:"is_preinstall"`
		IsLock               bool          `json:"is_lock"`
		DhcpEnable           int           `json:"dhcp_enable"`
		IsTraffic            bool          `json:"is_traffic"`
		NetworkCard          []interface{} `json:"network_card"`
		BootMode             string        `json:"boot_mode"`
		QrcodeUrl            string        `json:"qrcode_url"`
		DecommissionSchedule interface{}   `json:"decommission_schedule"`
		KvmType              string        `json:"kvm_type"`
	} `json:"server"`
}

func Detail

func Detail(ctx *dcimsdk.Context, request *DetailReq, opts ...dcimsdk.OptionFunc) (resp DetailResp, err error)

Detail 获取服务器详情 https://www.eolink.com/share/inside/XIPzIs/api/1389881/detail/5768957

func (DetailResp) Err

func (r DetailResp) Err() (err error)

func (DetailResp) Ok

func (r DetailResp) Ok() (ok bool)

type ImagesListReq

type ImagesListReq struct {
	ServerId uint // 服务器id
}

func (*ImagesListReq) Body

func (r *ImagesListReq) Body() (body any)

func (*ImagesListReq) Method

func (r *ImagesListReq) Method() (method string)

func (*ImagesListReq) Url

func (r *ImagesListReq) Url() (url string)

func (*ImagesListReq) Values

func (r *ImagesListReq) Values() (values url.Values)

type ImagesListResp

type ImagesListResp struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

func ImagesList

func ImagesList(ctx *dcimsdk.Context, request *ImagesListReq) (resp ImagesListResp, err error)

ImagesList 获取重装系统镜像列表 https://www.eolink.com/share/inside/XIPzIs/api/1398114/detail/5775256

type IpAddressListReq

type IpAddressListReq struct {
	BlockId  int  `url:"-"` // ip段id
	Page     uint `url:"page"`
	PageSize uint `url:"page_size"`
}

func (*IpAddressListReq) Body

func (r *IpAddressListReq) Body() (body any)

func (*IpAddressListReq) Method

func (r *IpAddressListReq) Method() (method string)

func (*IpAddressListReq) Url

func (r *IpAddressListReq) Url() (url string)

func (*IpAddressListReq) Values

func (r *IpAddressListReq) Values() (values url.Values)

type IpAddressListResp

type IpAddressListResp struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
	Address []struct {
		Id      int    `json:"id"`       // ip地址id
		BlockId int    `json:"block_id"` // ip段id
		Address string `json:"address"`  // ip地址
	} `json:"address"` // ip地址列表
	Total int `json:"total"` // 总条数
}

func IpAddressList

func IpAddressList(ctx *dcimsdk.Context, request *IpAddressListReq) (resp IpAddressListResp, err error)

IpAddressList 获取IP地址列表 https://www.eolink.com/share/inside/XIPzIs/api/1389881/detail/5782481

type IpAllotReq

type IpAllotReq struct {
	ServerId uint   `json:"server_id"` // 服务器id
	Address  []uint `json:"address"`   // ip地址数组
}

func (*IpAllotReq) Body

func (r *IpAllotReq) Body() (body any)

func (*IpAllotReq) Method

func (r *IpAllotReq) Method() (method string)

func (*IpAllotReq) Url

func (r *IpAllotReq) Url() (url string)

func (*IpAllotReq) Values

func (r *IpAllotReq) Values() (values url.Values)

type IpFreeReq

type IpFreeReq struct {
	ServerId  uint // 服务器id
	AddressId uint // ip地址id
}

func (*IpFreeReq) Body

func (r *IpFreeReq) Body() (body any)

func (*IpFreeReq) Method

func (r *IpFreeReq) Method() (method string)

func (*IpFreeReq) Url

func (r *IpFreeReq) Url() (url string)

func (*IpFreeReq) Values

func (r *IpFreeReq) Values() (values url.Values)

type IpMetadata

type IpMetadata struct {
	AddressId     uint   `json:"address_id,omitempty"`
	Address       string `json:"address,omitempty"`
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	BlockId       uint   `json:"block_id,omitempty"`
	Cidr          string `json:"cidr,omitempty"`
	IpmiBlockId   uint   `json:"ipmi_block_id,omitempty"`
	Id            uint   `json:"id,omitempty"`
	IpmiAddressId uint   `json:"ipmi_address_id,omitempty"`
	IpmiAddress   string `json:"ipmi_address,omitempty"`
}

type Ipv4

type Ipv4 struct {
	BlockId   string `json:"block_id"`   // ip段id
	AddressId string `json:"address_id"` // ip地址id
}

type Ipv4BlockListReq

type Ipv4BlockListReq struct {
	ServerId uint `uri:"-"`
	Page     uint `url:"page"`
	PageSize uint `url:"page_size"`
}

func (*Ipv4BlockListReq) Body

func (r *Ipv4BlockListReq) Body() (body any)

func (*Ipv4BlockListReq) Method

func (r *Ipv4BlockListReq) Method() (method string)

func (*Ipv4BlockListReq) Url

func (r *Ipv4BlockListReq) Url() (url string)

func (*Ipv4BlockListReq) Values

func (r *Ipv4BlockListReq) Values() (values url.Values)

type Ipv4BlockListResp

type Ipv4BlockListResp struct {
	Success    bool   `json:"success"`
	Error      string `json:"error"`
	Ipv4Blocks []struct {
		Id          int    `json:"id"`           // ip段id
		Ip          string `json:"ip"`           // id段
		GroupName   string `json:"group_name"`   // ip分组名称
		CanAllocate bool   `json:"can_allocate"` // 是否可分配
		UsableipNum int    `json:"usableip_num"` // 可使用的ip数量
		LockNum     int    `json:"lock_num"`     // 可使用的ip数量
		Percent     int    `json:"percent"`      // 百分比
	} `json:"ipv4blocks"` // ip段列表
	Total int `json:"total"`
}

type Ipv4ListReq

type Ipv4ListReq struct{ ServerId uint }

func (*Ipv4ListReq) Body

func (r *Ipv4ListReq) Body() (body any)

func (*Ipv4ListReq) Method

func (r *Ipv4ListReq) Method() (method string)

func (*Ipv4ListReq) Url

func (r *Ipv4ListReq) Url() (url string)

func (*Ipv4ListReq) Values

func (r *Ipv4ListReq) Values() (values url.Values)

type Ipv4ListResp

type Ipv4ListResp struct {
	Success bool `json:"success"`
	Ipv4    []struct {
		Id           int    `json:"id"`
		Cidr         string `json:"cidr"`
		Gateway      string `json:"gateway"`
		Netmask      string `json:"netmask"`
		Group        string `json:"group"`
		AssignTime   any    `json:"assign_time"`
		Vlan         string `json:"vlan"`
		IsWholeBlock bool   `json:"is_whole_block"`
		CardName     string `json:"card_name"`
		SwitchId     int    `json:"switch_id"`
		RouteType    any    `json:"route_type"`
		NextHop      any    `json:"next_hop"`
		Ranges       []struct {
			Id            int    `json:"id"`
			BlockId       int    `json:"block_id"`
			AddressString string `json:"address_string"`
		} `json:"ranges"`
	} `json:"ipv4"`
	Total int `json:"total"`
}

func Ipv4BlockList

func Ipv4BlockList(ctx *dcimsdk.Context, request *Ipv4BlockListReq) (resp Ipv4ListResp, err error)

Ipv4BlockList 获取IP段列表 https://www.eolink.com/share/inside/XIPzIs/api/1389881/detail/5782476

func Ipv4List

func Ipv4List(ctx *dcimsdk.Context, request *Ipv4ListReq) (resp Ipv4ListResp, err error)

type KvmReq

type KvmReq struct {
	ServerId int // 服务器id
}

func (*KvmReq) Body

func (r *KvmReq) Body() (body any)

func (*KvmReq) Method

func (r *KvmReq) Method() (method string)

func (*KvmReq) Url

func (r *KvmReq) Url() (url string)

func (*KvmReq) Values

func (r *KvmReq) Values() (values url.Values)

type ListReq

type ListReq struct {
	Name     string `url:"name"`
	Page     uint   `url:"page"`
	PageSize uint   `url:"page_size"`
}

func (*ListReq) Body

func (r *ListReq) Body() (body any)

func (*ListReq) Method

func (r *ListReq) Method() (method string)

func (*ListReq) Url

func (r *ListReq) Url() (url string)

func (*ListReq) Values

func (r *ListReq) Values() (values url.Values)

type ListResp

type ListResp struct {
	Success bool     `json:"success"`
	Error   string   `json:"error"`
	Server  []Server `json:"server"` // 服务器列表
	Total   int      `json:"total"`  // 总条数
}

func List

func List(ctx *dcimsdk.Context, request *ListReq) (resp ListResp, err error)

List 获取服务器列表 https://www.eolink.com/share/inside/XIPzIs/api/1389881/detail/5760736

func (ListResp) Err

func (r ListResp) Err() (err error)

func (ListResp) Ok

func (r ListResp) Ok() (ok bool)

type MainIpReq

type MainIpReq struct {
	ServerId  uint `json:"-"` // 服务器id
	AddressId uint `json:"-"` // ip地址id
}

func (*MainIpReq) Body

func (r *MainIpReq) Body() (body any)

func (*MainIpReq) Method

func (r *MainIpReq) Method() (method string)

func (*MainIpReq) Url

func (r *MainIpReq) Url() (url string)

func (*MainIpReq) Values

func (r *MainIpReq) Values() (values url.Values)

type PartListReq

type PartListReq struct{ ServerId int }

func (*PartListReq) Body

func (r *PartListReq) Body() (body any)

func (*PartListReq) Method

func (r *PartListReq) Method() (method string)

func (*PartListReq) Url

func (r *PartListReq) Url() (url string)

func (*PartListReq) Values

func (r *PartListReq) Values() (values url.Values)

type PartListResp

type PartListResp struct {
	Success     bool   `json:"success"`
	Error       string `json:"error"`
	ServerParts []struct {
		Id           int    `json:"id"`            // 硬件id
		TypeId       int    `json:"type_id"`       // 硬件类型id
		Brand        string `json:"brand"`         // 品牌
		Supplier     string `json:"supplier"`      // 供应商
		OfficalModel string `json:"officalmodel"`  // 型号
		Price        string `json:"price"`         // 价格
		DatacenterId int    `json:"datacenter_id"` // 数据中心id
		Qty          int    `json:"qty"`           // 数量
		Customfield0 string `json:"customfield0"`  // 自定义字段1
		Customfield1 string `json:"customfield1"`  // 自定义字段2
		Customfield2 string `json:"customfield2"`  // 自定义字段3
		Customfield3 string `json:"customfield3"`  // 自定义字段4
		PurchaseTime string `json:"purchase_time"` // 购买时间
		Remark       string `json:"remark"`        // 备注
		CreatedAt    int    `json:"created_at"`
		UpdatedAt    int    `json:"updated_at"`
		PartId       int    `json:"part_id"`   // 硬件组件id
		PartType     string `json:"part_type"` // 硬件组件类型
		Status       string `json:"status"`    // 硬件组件状态
	} `json:"server_parts"` // 服务器硬件列表
}

func PartList

func PartList(ctx *dcimsdk.Context, request *PartListReq) (resp PartListResp, err error)

PartList 获取服务器硬件列表 https://www.eolink.com/share/inside/XIPzIs/api/1389881/detail/5770400

type PowerStatusReq

type PowerStatusReq struct{ ServerId uint }

func (*PowerStatusReq) Body

func (r *PowerStatusReq) Body() (body any)

func (*PowerStatusReq) Method

func (r *PowerStatusReq) Method() (method string)

func (*PowerStatusReq) Url

func (r *PowerStatusReq) Url() (url string)

func (*PowerStatusReq) Values

func (r *PowerStatusReq) Values() (values url.Values)

type PowerStatusResp

type PowerStatusResp struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
	Power   string `json:"power"`
}

func PowerStatus

func PowerStatus(ctx *dcimsdk.Context, request *PowerStatusReq, opts ...dcimsdk.OptionFunc) (resp PowerStatusResp, err error)

PowerStatus 获取服务器电源状态 https://www.eolink.com/share/inside/XIPzIs/api/1389881/detail/5774112

func (PowerStatusResp) Err

func (r PowerStatusResp) Err() (err error)

func (PowerStatusResp) Ok

func (r PowerStatusResp) Ok() (ok bool)

type RebuildReq

type RebuildReq struct {
	ServerId         int    `url:"server_id" json:"server_id"`                   // 服务器id(必填)
	ImageId          string `url:"image_id" json:"image_id"`                     // 镜像id(必填)
	FormatSystemOnly bool   `url:"format_system_only" json:"format_system_only"` // 是否只格式化系统
	Password         string `url:"password" json:"password"`                     // 密码(必填)
	RemotePort       int    `url:"remote_port" json:"remote_port"`               // 远程端口
	IsPreinstall     int    `url:"is_preinstall" json:"is_preinstall"`           // 是否预装
	NewHostname      string `url:"new_hostname" json:"new_hostname"`             // 新的主机名
}

func (*RebuildReq) Body

func (r *RebuildReq) Body() (body any)

func (*RebuildReq) Method

func (r *RebuildReq) Method() (method string)

func (*RebuildReq) Url

func (r *RebuildReq) Url() (url string)

func (*RebuildReq) Values

func (r *RebuildReq) Values() (values url.Values)

type RebuildResp

type RebuildResp struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
	TaskUid string `json:"task_uid"` // 任务uid
	Log     string `json:"log"`      // 日志
}

type ResetPwdReq

type ResetPwdReq struct {
	ServerId int    `json:"-"`        // 服务器id
	Password string `json:"password"` // 密码
}

func (*ResetPwdReq) Body

func (r *ResetPwdReq) Body() (body any)

func (*ResetPwdReq) Method

func (r *ResetPwdReq) Method() (method string)

func (*ResetPwdReq) Url

func (r *ResetPwdReq) Url() (url string)

func (*ResetPwdReq) Values

func (r *ResetPwdReq) Values() (values url.Values)

type ResuceReq

type ResuceReq struct {
	ServerId int    `url:"server_id" json:"server_id"` // 服务器id
	Type     string `url:"type" json:"type"`           // 类型win(默认);linux
}

func (*ResuceReq) Body

func (r *ResuceReq) Body() (body any)

func (*ResuceReq) Method

func (r *ResuceReq) Method() (method string)

func (*ResuceReq) Url

func (r *ResuceReq) Url() (url string)

func (*ResuceReq) Values

func (r *ResuceReq) Values() (values url.Values)

type ResuceResp

type ResuceResp struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
	TaskUid string `json:"task_uid"` // 任务uid
	Log     string `json:"log"`      // 日志
}

type Server

type Server struct {
	Id              uint   `json:"id"`            // 服务器id
	Gid             int    `json:"gid"`           // 服务器分组id
	DatacenterId    uint   `json:"datacenter_id"` // 机房id
	CabinetId       uint   `json:"cabinet_id"`    // 机柜id
	Name            string `json:"name"`          // 服务器名称
	Hostname        string `json:"hostname"`      // 主机名
	PowerStatus     string `json:"power_status"`  // 电源状态
	Type            string `json:"type"`          // 类型
	MainMac         string `json:"main_mac"`      // 主mac地址
	MainIpv4Address struct {
		Address   string `json:"address"`    // ip地址
		Cidr      string `json:"cidr"`       // cidr
		Netmask   string `json:"netmask"`    // 子网掩码
		Gateway   string `json:"gateway"`    // 网关
		IsBlock   bool   `json:"is_block"`   // 是否分段
		Vlan      string `json:"vlan"`       // vlan
		GroupName string `json:"group_name"` // 分组名称
	} `json:"main_ipv4address"` // 主ip地址信息
	IpmiMetadata struct {
		AddressId       uint   `json:"address_id"`        // ip地址id
		Address         string `json:"address"`           // ip地址
		Username        string `json:"username"`          // 用户名
		Password        string `json:"password"`          // 密码
		BlockId         uint   `json:"block_id"`          // ip分段id
		PublicBlockId   uint   `json:"public_block_id"`   // 公网ip段id
		PublicAddressId uint   `json:"public_address_id"` // 公网ip地址id
		PublicAddress   string `json:"public_address"`    // 公网ip地址
		IpmiBlockId     uint   `json:"ipmi_block_id"`     // 公网ip地址id
		IpmiAddressId   uint   `json:"ipmi_address_id"`   // ipmi ip地址id
		IpmiAddress     string `json:"ipmi_address"`      // ipmi ip地址
		Cidr            string `json:"cidr"`              // cidr
	} `json:"ipmi_metadata"` // ipmi元数据
	Bandwidth    int    `json:"bandwidth"`     // 带宽
	Status       string `json:"status"`        // 状态
	DhcpEnable   int    `json:"dhcp_enable"`   // dhcp可用状态
	Osid         string `json:"osid"`          // 系统id
	Remark       string `json:"remark"`        // 备注
	RemarkUser   string `json:"remark_user"`   // 备注用户
	Disabled     int    `json:"disabled"`      // 禁用状态
	Username     string `json:"username"`      // 用户名
	Password     string `json:"password"`      // 密码
	RemotePort   int    `json:"remote_port"`   // 远程端口
	Card         int    `json:"card"`          // 网卡数量
	IsLock       bool   `json:"is_lock"`       // 锁定状态
	IsPreinstall int    `json:"is_preinstall"` // 是否预装系统
	CreatedAt    string `json:"created_at"`    // 创建时间
	UpdatedAt    string `json:"updated_at"`    // 更新时间
	Ipv4Count    int    `json:"ipv4_count"`    // ipv4数量
	User         []struct {
		Id   int    `json:"id"`   // 用户id
		Name string `json:"name"` // 用户名称
	} `json:"user"` // 用户信息
	Switch  []Switch `json:"switch"`   // 交换机信息
	IsIssue bool     `json:"is_issue"` // 是否故障
	Part    struct {
		Field1 any `json:"1"`
		Field2 any `json:"2"`
		Field3 any `json:"3"`
		Field4 any `json:"4"`
	} `json:"part"` // 硬件信息(TODO 里面属性暂时不写,有需要再补上)
	TotalFlow              int    `json:"total_flow"`                // 总流量
	Used                   int    `json:"used"`                      // 已使用
	Flow                   int    `json:"flow"`                      // 流量
	OtherFlow              int    `json:"other_flow"`                // 其他流量
	RealHardwareHistoryOne any    `json:"real_hardware_history_one"` // 真实硬件历史
	Hardware               string `json:"hardware"`                  // 硬件
	Cabinet                struct {
		Id     int    `json:"id"`      // 机柜id
		Name   string `json:"name"`    // 机柜名称
		IsLock int    `json:"is_lock"` // 锁定状态
	} `json:"cabinet"` // 机柜信息
	Datacenter struct {
		Id   int    `json:"id"`   // 数据中心id
		Name string `json:"name"` // 数据中心名称
	} `json:"datacenter"` // 数据中心信息(机房)
	Packages []struct {
		Id   int    `json:"id"`   // 套餐包id
		Name string `json:"name"` // 套餐包名称
	} `json:"packages"` // 套餐包信息
	Lock []any `json:"lock"` // 锁定状态
}

type SpeedReq

type SpeedReq struct {
	ServerId     uint   `json:"-"`
	SwitchPortId uint   `json:"-"`
	UpPort       string `json:"up_port"`
	DownPort     string `json:"down_port"`
}

func (*SpeedReq) Body

func (r *SpeedReq) Body() (body any)

func (*SpeedReq) Method

func (r *SpeedReq) Method() (method string)

func (*SpeedReq) Url

func (r *SpeedReq) Url() (url string)

func (*SpeedReq) Values

func (r *SpeedReq) Values() (values url.Values)

type Switch

type Switch struct {
	Id       uint     `json:"id"`        // 交换机id
	PortName string   `json:"port_name"` // 端口名
	UpPort   int      `json:"up_port"`   // 上行端口
	DownPort int      `json:"down_port"` // 下载端口
	VlanType string   `json:"vlan_type"` // vlan类型
	Vlans    []string `json:"vlans"`     // vlan类表
	PortId   uint     `json:"port_id"`   // 端口id
	Switch   string   `json:"switch"`    // 交换机ip地址
	IsLock   int      `json:"is_lock"`   // 锁定状态
	Disabled bool     `json:"-"`
}

type SwitchPort

type SwitchPort struct {
	Id     uint `json:"id"`
	PortId uint `json:"port_id"`
}

type TaskStatusReq

type TaskStatusReq struct {
	ServerId int // 服务器id
	TaskId   int // 任务id
}

func (*TaskStatusReq) Body

func (r *TaskStatusReq) Body() (body any)

func (*TaskStatusReq) Method

func (r *TaskStatusReq) Method() (method string)

func (*TaskStatusReq) Url

func (r *TaskStatusReq) Url() (url string)

func (*TaskStatusReq) Values

func (r *TaskStatusReq) Values() (values url.Values)

type UpdateReq

type UpdateReq struct {
	Id                uint               `json:"id"` // 服务器id
	Name              string             `json:"name"`
	Hostname          string             `json:"hostname"`
	Datacenter        dcimsdk.OnlyIdType `json:"datacenter"`          // 数据中心信息(机房)
	Cabinet           dcimsdk.OnlyIdType `json:"cabinet"`             // 机柜信息
	Hardware          dcimsdk.OnlyIdType `json:"hardware"`            // 硬件信息
	Switch            []SwitchPort       `json:"switch"`              // 交换机信息(必填)
	IpmiMetadata      IpMetadata         `json:"ipmi_metadata"`       // ipmi元信息
	Type              string             `json:"type"`                // 类型
	Card              int                `json:"card"`                // 网卡数量
	Part              struct{}           `json:"part"`                // 组成部分
	ShelfTime         string             `json:"shelf_time"`          // 上架时间
	Gid               uint               `json:"gid,omitempty"`       // 分组id
	DisabledNetwork   int                `json:"disabled_network"`    // 是否禁用网络
	NetworkMetadata   int                `json:"network_metadata"`    // 网络元数据
	Status            string             `json:"status"`              // 状态
	Osid              string             `json:"osid"`                // 镜像名称
	Disabled          bool               `json:"disabled"`            // 禁用状态
	Username          string             `json:"username"`            // 用户名
	Password          string             `json:"password"`            // 密码
	MainMac           string             `json:"main_mac"`            // 主mac地址
	Bandwidth         int                `json:"bandwidth"`           // 带宽
	AllowRemoteSwitch bool               `json:"allow_remote_switch"` // 是否允许远程交换机
	Force             bool               `json:"force"`               // 是否强制
	DhcpEnable        int                `json:"dhcp_enable"`         // dhcp可用状态
	Unit              []int              `json:"unit,omitempty"`      // 单元容量
	BladeId           string             `json:"blade_id"`            // 刀片服务器架构id
	BladeUnit         string             `json:"blade_unit"`          // 刀片单元容量
}

func (*UpdateReq) Body

func (r *UpdateReq) Body() (body any)

func (*UpdateReq) Method

func (r *UpdateReq) Method() (method string)

func (*UpdateReq) Url

func (r *UpdateReq) Url() (url string)

func (*UpdateReq) Values

func (r *UpdateReq) Values() (values url.Values)

type VncReq

type VncReq struct{ ServerId int }

func (*VncReq) Body

func (r *VncReq) Body() (body any)

func (*VncReq) Method

func (r *VncReq) Method() (method string)

func (*VncReq) Url

func (r *VncReq) Url() (url string)

func (*VncReq) Values

func (r *VncReq) Values() (values url.Values)

type VncResp

type VncResp struct {
	Success  bool   `json:"success"`
	Error    string `json:"error"`
	Endpoint string `json:"endpoint"` // 被控主机
}

func Vnc

func Vnc(ctx *dcimsdk.Context, request *VncReq) (resp VncResp, err error)

Vnc 获取vnc(测试) https://www.eolink.com/share/inside/XIPzIs/api/1389881/detail/5773774

Jump to

Keyboard shortcuts

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