sgrules

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 {
	ID          uint   `json:"-"`           // 安全组ID
	Description string `json:"description"` // 描述
	Direction   string `json:"direction"`   // 规则方向(in进方向,out出方向)
	Protocol    string `json:"protocol"`    // 协议(all,all_tcp,all_udp,tcp,udp,icmp,ssh,telnet,http,https,mssql,oracle,mysql,rdp,postgresql,redis,gre)
	Port        string `json:"port"`        // 端口范围(专业版)
	Ip          string `json:"ip"`          // 授权IP(专业版,Hyper-V)
	Lock        int    `json:"lock"`        // 是否锁定(0不锁定,1锁定,v2.3.0+)
	StartIp     string `json:"start_ip"`    // 起始IP(轻量版)
	EndIp       string `json:"end_ip"`      // 结束IP(轻量版)
	StartPort   int    `json:"start_port"`  // 起始端口(轻量版,Hyper-V)
	EndPort     int    `json:"end_port"`    // 结束端口(轻量版,Hyper-V)
	Priority    int    `json:"priority"`    // 优先级(轻量版)
	Action      string `json:"action"`      // 授权策略(accept=允许,drop=拒绝,轻量版,Hyper-V)
}

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{}

func Create

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

Create 添加安全组规则

type DeleteReq

type DeleteReq struct {
	ID  uint `json:"-"` // 安全组规则ID
	Uid uint `json:"uid"`
}

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 ListReq

type ListReq struct {
	ID        uint   `url:"-"`                   // 安全组ID
	Search    string `url:"search,omitempty"`    // 搜索
	Direction string `url:"direction,omitempty"` // 规则方向筛选(in=进方向,out=出方向,v2.4.1+)
	PerPage   string `url:"per_page,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
		Description string `json:"description"` // 描述
		Direction   string `json:"direction"`   // 规则方向
		Protocol    string `json:"protocol"`    // 协议
		Port        string `json:"port"`        // 端口范围(专业版)
		Ip          string `json:"ip"`          // 授权IP(专业版,Hyper-V)
		CreateTime  string `json:"create_time"` // 创建时间
		Lock        int    `json:"lock"`        // 是否锁定(0不锁定,1锁定,v2.3.0+)
		StartIp     string `json:"start_ip"`    // 起始IP(轻量版)
		EndIp       string `json:"end_ip"`      // 结束IP(轻量版)
		StartPort   int    `json:"start_port"`  // 起始端口(轻量版,Hyper-V)
		EndPort     int    `json:"end_port"`    // 结束端口(轻量版,Hyper-V)
		Priority    int    `json:"priority"`    // 优先级(轻量版)
		Action      string `json:"action"`      // 授权策略(accept=允许,drop=拒绝,轻量版,Hyper-V)
	} `json:"data"`
	Meta struct {
		Total           int `json:"total"`
		TotalPage       int `json:"total_page"`
		Page            int `json:"page"`
		PerPage         int `json:"per_page"`
		DirectionInNum  int `json:"direction_in_num"`  // 进方向规则总数(v2.4.1+)
		DirectionOutNum int `json:"direction_out_num"` // 出方向规则总数(v2.4.1+)
	} `json:"meta"`
}

func List

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

List 安全组规则列表

type ProtocolsReq

type ProtocolsReq struct{}

func (*ProtocolsReq) Body

func (r *ProtocolsReq) Body() any

func (*ProtocolsReq) Form

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

func (*ProtocolsReq) Header

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

func (*ProtocolsReq) Method

func (r *ProtocolsReq) Method() string

func (*ProtocolsReq) Url

func (r *ProtocolsReq) Url() string

func (*ProtocolsReq) Values

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

type ProtocolsResp

type ProtocolsResp struct {
	// contains filtered or unexported fields
}

func Protocols

func Protocols(ctx *cputil.Context, req *ProtocolsReq) ([]*ProtocolsResp, error)

Protocols 获取规则可用协议

type UpdateReq

type UpdateReq struct {
	ID          uint   `json:"-"`           // 安全组规则ID
	Description string `json:"description"` // 描述
	Direction   string `json:"direction"`   // 规则方向(in进方向,out出方向)
	Protocol    string `json:"protocol"`    // 协议(all,all_tcp,all_udp,tcp,udp,icmp,ssh,telnet,http,https,mssql,oracle,mysql,rdp,postgresql,redis,gre)
	Port        string `json:"port"`        // 端口范围(专业版)
	Ip          string `json:"ip"`          // 授权IP(专业版,Hyper-V)
	Lock        int    `json:"lock"`        // 是否锁定(0不锁定,1锁定,v2.3.0+)
	StartIp     string `json:"start_ip"`    // 起始IP(轻量版)
	EndIp       string `json:"end_ip"`      // 结束IP(轻量版)
	StartPort   int    `json:"start_port"`  // 起始端口(轻量版,Hyper-V)
	EndPort     int    `json:"end_port"`    // 结束端口(轻量版,Hyper-V)
	Priority    int    `json:"priority"`    // 优先级(轻量版)
	Action      string `json:"action"`      // 授权策略(accept=允许,drop=拒绝,轻量版,Hyper-V)
}

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