sg

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateReq

type CreateReq struct {
	Name        string `json:"name"`        // 名称
	Description string `json:"description"` // 描述
	Uid         int    `json:"uid"`         // 用户ID
	Hostid      int    `json:"hostid"`      // 实例ID(如果有添加并关联到该实例)
	Rid         int    `json:"rid"`         // 资源包ID
	Type        string `json:"type"`        // 安全组类型(host=专业魔方云,lightHost=轻量魔方云,hyperv=Hyper-V,v2.5.2+)
}

func (*CreateReq) Body

func (r *CreateReq) Body() any

func (*CreateReq) Form

func (r *CreateReq) Form() (form url.Values)

func (*CreateReq) Header

func (r *CreateReq) Header() http.Header

func (*CreateReq) Method

func (r *CreateReq) Method() string

func (*CreateReq) Url

func (r *CreateReq) Url() string

func (*CreateReq) Values

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

type CreateResp

type CreateResp struct {
	ID string `json:"id"` // 安全组ID
}

func Create

func Create(ctx *cputil.Context, req *CreateReq) (*CreateResp, error)

Create 创建安全组

type DeleteReq

type DeleteReq struct {
	ID uint `url:"-"` // 安全组ID
}

func (*DeleteReq) Body

func (r *DeleteReq) Body() any

func (*DeleteReq) Form

func (r *DeleteReq) Form() (form url.Values)

func (*DeleteReq) Header

func (r *DeleteReq) Header() http.Header

func (*DeleteReq) Method

func (r *DeleteReq) Method() string

func (*DeleteReq) Url

func (r *DeleteReq) Url() string

func (*DeleteReq) Values

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

type DeleteResp

type DeleteResp struct{}

func Delete

func Delete(ctx *cputil.Context, req *DeleteReq) (*DeleteResp, error)

Delete 删除安全组

type DetailReq

type DetailReq struct {
	ID         uint   `url:"-"`
	GetAllRule string `url:"get_all_rule,omitempty"` // 是否获取所有规则(0不,1获取)
}

func (*DetailReq) Body

func (r *DetailReq) Body() any

func (*DetailReq) Form

func (r *DetailReq) Form() (form url.Values)

func (*DetailReq) Header

func (r *DetailReq) Header() http.Header

func (*DetailReq) Method

func (r *DetailReq) Method() string

func (*DetailReq) Url

func (r *DetailReq) Url() string

func (*DetailReq) Values

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

type DetailResp

type DetailResp struct {
	Id          int    `json:"id"`          // 规则ID
	Name        string `json:"name"`        // 名称
	Description string `json:"description"` // 描述
	Uid         int    `json:"uid"`         // 用户ID
	CreateTime  string `json:"create_time"` // 创建时间
	UpdateTime  string `json:"update_time"` // 修改时间
	CloudNum    int    `json:"cloud_num"`   // 关联实例数量
	Username    string `json:"username"`    // 用户名
	Type        string `json:"type"`        // 安全组类型(host=专业魔方云,lightHost=轻量魔方云,hyperv=Hyper-V,v2.5.2+)
	Rule        []struct {
		Id          int    `json:"id"`          // 安全组规则ID
		Description string `json:"description"` // 描述
		Direction   string `json:"direction"`   // 规则方向
		Protocol    string `json:"protocol"`    // 协议
		Port        string `json:"port"`        // 端口范围
		Ip          string `json:"ip"`          // 授权IP
		CreateTime  string `json:"create_time"` // 创建时间
	} `json:"rule"`
}

func Detail

func Detail(ctx *cputil.Context, req *DetailReq) (*DetailResp, error)

Detail 安全组详情

type LinksReq

type LinksReq struct {
	Cloud []uint `json:"cloud"` // 实例ID
	ID    uint   `json:"id"`    // 安全组ID
	Type  uint   `json:"type"`  // 类型(0其他该安全组实例会被移除,1不影响该安全组其他实例关联)
}

func (*LinksReq) Body

func (r *LinksReq) Body() any

func (*LinksReq) Form

func (r *LinksReq) Form() (form url.Values)

func (*LinksReq) Header

func (r *LinksReq) Header() http.Header

func (*LinksReq) Method

func (r *LinksReq) Method() string

func (*LinksReq) Url

func (r *LinksReq) Url() string

func (*LinksReq) Values

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

type LinksResp

type LinksResp struct{}
func Links(ctx *cputil.Context, req *LinksReq) (*LinksResp, error)

Links 关联安全组

type ListReq

type ListReq struct {
	Search   string `url:"search,omitempty"`    // 搜索
	ListType string `url:"list_type,omitempty"` // 获取类型(all,page),all会忽略页数直接返回所有
	Type     string `url:"list_type,omitempty"` // 安全组类型(host=专业魔方云,lightHost=轻量魔方云,hyperv=Hyper-V,v2.5.2+)
	User     string `url:"user,omitempty"`      // 用户ID

	Page    string `url:"page,omitempty"`
	PerPage string `url:"per_page,omitempty"`
	Orderby string `url:"orderby,omitempty"` // 排序(id,name,ext_port,int_port,protocol)
	Sort    string `url:"sort,omitempty"`
}

func (*ListReq) Body

func (r *ListReq) Body() any

func (*ListReq) Form

func (r *ListReq) Form() (form url.Values)

func (*ListReq) Header

func (r *ListReq) Header() http.Header

func (*ListReq) Method

func (r *ListReq) Method() string

func (*ListReq) Url

func (r *ListReq) Url() string

func (*ListReq) Values

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

type ListResp

type ListResp struct {
	Data []struct {
		Id          int    `json:"id"`          // 安全组ID
		Name        string `json:"name"`        // 名称
		Description string `json:"description"` // 描述
		Uid         int    `json:"uid"`         // 用户ID
		CloudNum    int    `json:"cloud_num"`   // 关联数
		Username    string `json:"username"`    // 用户名
		RuleNum     int    `json:"rule_num"`    // 安全组规则数量
		CreateTime  string `json:"create_time"` // 创建时间
		Type        string `json:"type"`        // 安全组类型(host = 专业魔方云, lightHost = 轻量魔方云, hyperv = Hyper-V, v2.5.2+)
	} `json:"data"`
	Meta struct {
		Total     int `json:"total"`
		TotalPage int `json:"total_page"`
		Page      int `json:"page"`
		PerPage   int `json:"per_page"`
	} `json:"meta"`
}

func List

func List(ctx *cputil.Context, req *ListReq) (*ListResp, error)

List 安全组列表

type UnlinksReq

type UnlinksReq struct {
	SgID uint `json:"-"`  // 安全组ID
	ID   uint `json:"id"` // 实例ID
}

func (*UnlinksReq) Body

func (r *UnlinksReq) Body() any

func (*UnlinksReq) Form

func (r *UnlinksReq) Form() (form url.Values)

func (*UnlinksReq) Header

func (r *UnlinksReq) Header() http.Header

func (*UnlinksReq) Method

func (r *UnlinksReq) Method() string

func (*UnlinksReq) Url

func (r *UnlinksReq) Url() string

func (*UnlinksReq) Values

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

type UnlinksResp

type UnlinksResp struct{}
func Unlinks(ctx *cputil.Context, req *UnlinksReq) (*UnlinksResp, error)

Unlinks 解除关联安全组

type UpdateReq

type UpdateReq struct {
	ID          uint   `json:"-"`           // 安全组ID
	Name        string `json:"name"`        // 名称
	Description string `json:"description"` // 描述
}

func (*UpdateReq) Body

func (r *UpdateReq) Body() any

func (*UpdateReq) Form

func (r *UpdateReq) Form() (form url.Values)

func (*UpdateReq) Header

func (r *UpdateReq) Header() http.Header

func (*UpdateReq) Method

func (r *UpdateReq) Method() string

func (*UpdateReq) Url

func (r *UpdateReq) Url() string

func (*UpdateReq) Values

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

type UpdateResp

type UpdateResp struct{}

func Update

func Update(ctx *cputil.Context, req *UpdateReq) (*UpdateResp, error)

Update 修改安全组

Jump to

Keyboard shortcuts

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