v1

package
v0.0.0-...-6d513be Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package v1 provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.

Package v1 provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerAuthScopes = "BearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router gin.IRouter, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type AddHostRuleJSONBody

type AddHostRuleJSONBody struct {
	Rules []string `json:"rules"`
}

AddHostRuleJSONBody defines parameters for AddHostRule.

type AddHostRuleJSONRequestBody

type AddHostRuleJSONRequestBody AddHostRuleJSONBody

AddHostRuleJSONRequestBody defines body for AddHostRule for application/json ContentType.

type ChangePasswordJSONRequestBody

type ChangePasswordJSONRequestBody = ChangePasswordRequest

ChangePasswordJSONRequestBody defines body for ChangePassword for application/json ContentType.

type ChangePasswordRequest

type ChangePasswordRequest struct {
	ConfirmPassword string `json:"confirm_password"`
	NewPassword     string `json:"new_password"`
	OldPassword     string `json:"old_password"`
}

ChangePasswordRequest defines model for ChangePasswordRequest.

type CheckEnrollCodeJSONBody

type CheckEnrollCodeJSONBody struct {
	Code string `json:"code"`
}

CheckEnrollCodeJSONBody defines parameters for CheckEnrollCode.

type CheckEnrollCodeJSONRequestBody

type CheckEnrollCodeJSONRequestBody CheckEnrollCodeJSONBody

CheckEnrollCodeJSONRequestBody defines body for CheckEnrollCode for application/json ContentType.

type CheckEnrollCodeResponse

type CheckEnrollCodeResponse struct {
	// Exists 如果存在表示还没注册
	Exists *bool `json:"exists,omitempty"`
}

CheckEnrollCodeResponse defines model for CheckEnrollCodeResponse.

type CreateEnrollCodeResponse

type CreateEnrollCodeResponse struct {
	// Code The enroll code
	Code            string `json:"code"`
	LifetimeSeconds int64  `json:"lifetime_seconds"`
}

CreateEnrollCodeResponse defines model for CreateEnrollCodeResponse.

type CreateHostJSONBody

type CreateHostJSONBody struct {
	// IpAddress IP address
	IpAddress string `json:"ip_address"`

	// IsLighthouse SIS lighthouse
	IsLighthouse bool `json:"is_lighthouse"`

	// Name Host name
	Name string `json:"name"`

	// NetworkId Network id
	NetworkId string `json:"network_id"`

	// Port Host listening port
	Port int `json:"port"`

	// PublicIp 公网ip
	PublicIp string `json:"public_ip"`

	// Role Host type
	Role  CreateHostJSONBodyRole `json:"role"`
	Rules []string               `json:"rules"`

	// StaticAddresses Static addresses
	StaticAddresses []string `json:"static_addresses"`
}

CreateHostJSONBody defines parameters for CreateHost.

type CreateHostJSONBodyRole

type CreateHostJSONBodyRole string

CreateHostJSONBodyRole defines parameters for CreateHost.

const (
	Lighthouse CreateHostJSONBodyRole = "lighthouse"
	None       CreateHostJSONBodyRole = "none"
)

Defines values for CreateHostJSONBodyRole.

type CreateHostJSONRequestBody

type CreateHostJSONRequestBody CreateHostJSONBody

CreateHostJSONRequestBody defines body for CreateHost for application/json ContentType.

type CreateNetworkJSONRequestBody

type CreateNetworkJSONRequestBody = CreateNetworkRequest

CreateNetworkJSONRequestBody defines body for CreateNetwork for application/json ContentType.

type CreateNetworkRequest

type CreateNetworkRequest struct {
	// Cidr CIDR notation of the network address and subnet mask (e.g., "192.168.1.0/24")
	Cidr string `json:"cidr"`

	// Name Name of the network
	Name string `json:"name"`
}

CreateNetworkRequest defines model for CreateNetworkRequest.

type CreateNetworkResponse

type CreateNetworkResponse struct {
	// Cidr CIDR notation of the network address and subnet mask (e.g., "192.168.1.0/24")
	Cidr      string `json:"cidr"`
	CreatedAt string `json:"createdAt"`

	// Id ID of the network
	Id string `json:"id"`

	// Name Name of the network
	Name string `json:"name"`
}

CreateNetworkResponse defines model for CreateNetworkResponse.

type CreateRuleJSONRequestBody

type CreateRuleJSONRequestBody = Rule

CreateRuleJSONRequestBody defines body for CreateRule for application/json ContentType.

type EnrollHostResponse

type EnrollHostResponse struct {
	Config     string `json:"config"`
	EnrollAt   int64  `json:"enroll_at"`
	HostId     string `json:"host_id"`
	LastSeenAt string `json:"last_seen_at"`
	Online     bool   `json:"online"`
}

EnrollHostResponse defines model for EnrollHostResponse.

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type Host

type Host struct {
	CreatedAt string `json:"created_at"`

	// Id ID of the host
	Id         string `json:"id"`
	IpAddress  string `json:"ip_address"`
	LastSeenAt string `json:"last_seen_at"`
	Name       string `json:"name"`
	NetworkId  string `binding:"required" json:"network_id"`

	// Online Whether the host is online or not
	Online bool `json:"online"`
	Port   int  `json:"port"`

	// PublicIp Public IP address
	PublicIp string   `json:"public_ip"`
	Role     HostRole `json:"role"`

	// StaticAddresses Static addresses
	StaticAddresses map[string]string      `json:"static_addresses"`
	Tags            map[string]interface{} `json:"tags"`
}

Host defines model for Host.

type HostConfig

type HostConfig struct {
	Config string `json:"config"`
}

HostConfig defines model for HostConfig.

type HostFindOptions

type HostFindOptions struct {
	// Filters Filter options
	Filters map[string]interface{} `json:"filters"`

	// IpAddress Filter by IP address
	IpAddress string `json:"ip_address"`

	// Limit Number of results to return
	Limit int `json:"limit"`

	// Name Filter by name
	Name string `json:"name"`

	// NetworkId Filter by network ID
	NetworkId string `json:"network_id"`

	// Offset Offset for pagination
	Offset int `json:"offset"`

	// Role Filter by role
	Role HostFindOptionsRole `json:"role"`

	// Sort Sorting options
	Sort map[string]interface{} `json:"sort"`
}

HostFindOptions defines model for HostFindOptions.

type HostFindOptionsRole

type HostFindOptionsRole string

HostFindOptionsRole Filter by role

const (
	HostFindOptionsRoleLighthouse HostFindOptionsRole = "lighthouse"
	HostFindOptionsRoleNone       HostFindOptionsRole = "none"
)

Defines values for HostFindOptionsRole.

type HostRole

type HostRole string

HostRole defines model for Host.Role.

const (
	HostRoleLighthouse HostRole = "lighthouse"
	HostRoleNone       HostRole = "none"
)

Defines values for HostRole.

type HostRule

type HostRule struct {
	Action      HostRuleAction `json:"action"`
	CreatedAt   string         `json:"created_at"`
	Description string         `json:"description"`
	Host        []string       `json:"host"`
	HostId      string         `json:"host_id"`
	Id          string         `json:"id"`
	Name        string         `json:"name"`
	Port        string         `json:"port"`
	Proto       HostRuleProto  `json:"proto"`
	Type        HostRuleType   `json:"type"`
}

HostRule defines model for HostRule.

type HostRuleAction

type HostRuleAction string

HostRuleAction defines model for HostRule.Action.

const (
	HostRuleActionAllow HostRuleAction = "allow"
	HostRuleActionDeny  HostRuleAction = "deny"
)

Defines values for HostRuleAction.

type HostRuleProto

type HostRuleProto string

HostRuleProto defines model for HostRule.Proto.

const (
	HostRuleProtoAny  HostRuleProto = "any"
	HostRuleProtoIcmp HostRuleProto = "icmp"
	HostRuleProtoTcp  HostRuleProto = "tcp"
	HostRuleProtoUdp  HostRuleProto = "udp"
)

Defines values for HostRuleProto.

type HostRuleType

type HostRuleType string

HostRuleType defines model for HostRule.Type.

const (
	HostRuleTypeInbound  HostRuleType = "inbound"
	HostRuleTypeOutbound HostRuleType = "outbound"
)

Defines values for HostRuleType.

type ListHostParams

type ListHostParams struct {
	// FindOptions Options for filtering, sorting, and pagination
	FindOptions *HostFindOptions `form:"findOptions,omitempty" json:"findOptions,omitempty"`
}

ListHostParams defines parameters for ListHost.

type ListHostRulesParams

type ListHostRulesParams struct {
	// PageNum 页码
	PageNum *int `form:"page_num,omitempty" json:"page_num,omitempty"`

	// PageSize 页大小
	PageSize *int `form:"page_size,omitempty" json:"page_size,omitempty"`
}

ListHostRulesParams defines parameters for ListHostRules.

type ListRuleParams

type ListRuleParams struct {
	// RuleFindOptions Options for filtering, sorting, and pagination
	RuleFindOptions *RuleFindOptions `form:"ruleFindOptions,omitempty" json:"ruleFindOptions,omitempty"`
}

ListRuleParams defines parameters for ListRule.

type LoginRequest

type LoginRequest struct {
	Email    *openapi_types.Email `json:"email,omitempty"`
	Password *string              `json:"password,omitempty"`
}

LoginRequest defines model for LoginRequest.

type LoginUserJSONRequestBody

type LoginUserJSONRequestBody = LoginRequest

LoginUserJSONRequestBody defines body for LoginUser for application/json ContentType.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type Network

type Network struct {
	// Cidr CIDR notation of the network address and subnet mask (e.g., "192.168.1.0/24")
	Cidr string `json:"cidr"`

	// CreatedAt Creation timestamp
	CreatedAt string `json:"created_at"`

	// Id ID of the network
	Id string `json:"id"`

	// Name Name of the network
	Name string `json:"name"`
}

Network defines model for Network.

type RegisterUserJSONBody

type RegisterUserJSONBody struct {
	ConfirmPassword string              `json:"confirm_password"`
	Email           openapi_types.Email `json:"email"`

	// Name 用户名
	Name     *string `json:"name,omitempty"`
	Password string  `json:"password"`
}

RegisterUserJSONBody defines parameters for RegisterUser.

type RegisterUserJSONRequestBody

type RegisterUserJSONRequestBody RegisterUserJSONBody

RegisterUserJSONRequestBody defines body for RegisterUser for application/json ContentType.

type Rule

type Rule struct {
	Action      RuleAction `json:"action"`
	CreatedAt   int        `json:"created_at"`
	Description string     `json:"description"`

	// Host 源地址
	Host  string    `json:"host"`
	Id    string    `json:"id"`
	Name  string    `json:"name"`
	Port  string    `json:"port"`
	Proto RuleProto `json:"proto"`
	Type  RuleType  `json:"type"`
}

Rule defines model for Rule.

type RuleAction

type RuleAction string

RuleAction defines model for Rule.Action.

const (
	RuleActionAllow RuleAction = "allow"
	RuleActionDeny  RuleAction = "deny"
)

Defines values for RuleAction.

type RuleFindOptions

type RuleFindOptions struct {
	// HostId Host ID
	HostId string `json:"host_id"`

	// PageNum Page number
	PageNum int `json:"page_num"`

	// PageSize Number of results to return
	PageSize int `json:"page_size"`
}

RuleFindOptions defines model for RuleFindOptions.

type RuleProto

type RuleProto string

RuleProto defines model for Rule.Proto.

const (
	RuleProtoAny  RuleProto = "any"
	RuleProtoIcmp RuleProto = "icmp"
	RuleProtoTcp  RuleProto = "tcp"
	RuleProtoUdp  RuleProto = "udp"
)

Defines values for RuleProto.

type RuleType

type RuleType string

RuleType defines model for Rule.Type.

const (
	RuleTypeInbound  RuleType = "inbound"
	RuleTypeOutbound RuleType = "outbound"
)

Defines values for RuleType.

type SendCodeJSONRequestBody

type SendCodeJSONRequestBody = SendCodeRequest

SendCodeJSONRequestBody defines body for SendCode for application/json ContentType.

type SendCodeRequest

type SendCodeRequest struct {
	Code  *string              `json:"code,omitempty"`
	Email *openapi_types.Email `json:"email,omitempty"`
}

SendCodeRequest defines model for SendCodeRequest.

type ServerInterface

type ServerInterface interface {
	// List all hosts
	// (GET /api/v1/hosts)
	ListHost(c *gin.Context, params ListHostParams)
	// 创建主机
	// (POST /api/v1/hosts)
	CreateHost(c *gin.Context)
	// 注册主机
	// (POST /api/v1/hosts/enroll/{code})
	EnrollHost(c *gin.Context, code string)
	// 删除主机
	// (DELETE /api/v1/hosts/{hostId})
	DeleteHost(c *gin.Context, hostId string)
	// Get a host
	// (GET /api/v1/hosts/{hostId})
	GetHost(c *gin.Context, hostId string)
	// 更新主机
	// (PUT /api/v1/hosts/{hostId})
	UpdateHost(c *gin.Context, hostId string)
	// 获取主机配置
	// (GET /api/v1/hosts/{hostId}/config)
	GetHostConfig(c *gin.Context, hostId string)
	// Create an enroll code
	// (POST /api/v1/hosts/{hostId}/enroll-code)
	CreateEnrollCode(c *gin.Context, hostId string)

	// (POST /api/v1/hosts/{hostId}/enroll-code-check)
	CheckEnrollCode(c *gin.Context, hostId string)
	// 获取主机规则
	// (GET /api/v1/hosts/{hostId}/rules)
	ListHostRules(c *gin.Context, hostId string, params ListHostRulesParams)
	// 添加主机规则
	// (POST /api/v1/hosts/{hostId}/rules)
	AddHostRule(c *gin.Context, hostId string)
	// 删除主机规则
	// (DELETE /api/v1/hosts/{hostId}/rules/{ruleId})
	DeleteHostRule(c *gin.Context, hostId string, ruleId string)
	// List all networks
	// (GET /api/v1/networks)
	GetAllNetwork(c *gin.Context)
	// Create a new Network
	// (POST /api/v1/networks)
	CreateNetwork(c *gin.Context)
	// Delete a host
	// (DELETE /api/v1/networks/{networkId})
	DeleteNetwork(c *gin.Context, networkId string)
	// Get a network
	// (GET /api/v1/networks/{networkId})
	GetNetwork(c *gin.Context, networkId string)
	// Update a network
	// (PUT /api/v1/networks/{networkId})
	UpdateNetwork(c *gin.Context, networkId string)
	// List all rules
	// (GET /api/v1/rules)
	ListRule(c *gin.Context, params ListRuleParams)
	// 创建规则
	// (POST /api/v1/rules)
	CreateRule(c *gin.Context)
	// deleteRule
	// (DELETE /api/v1/rules/{id})
	DeleteRule(c *gin.Context, id string)
	// 更改用户密码
	// (POST /api/v1/users/change-password)
	ChangePassword(c *gin.Context)
	// 用户登录
	// (POST /api/v1/users/login)
	LoginUser(c *gin.Context)
	// 获取当前用户信息
	// (GET /api/v1/users/me)
	GetUserInfo(c *gin.Context)
	// 用户注册
	// (POST /api/v1/users/register)
	RegisterUser(c *gin.Context)
	// 发送验证码
	// (POST /api/v1/users/send-code)
	SendCode(c *gin.Context)
	// 验证验证码
	// (GET /api/v1/users/verify-code)
	VerifyCode(c *gin.Context, params VerifyCodeParams)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) AddHostRule

func (siw *ServerInterfaceWrapper) AddHostRule(c *gin.Context)

AddHostRule operation middleware

func (*ServerInterfaceWrapper) ChangePassword

func (siw *ServerInterfaceWrapper) ChangePassword(c *gin.Context)

ChangePassword operation middleware

func (*ServerInterfaceWrapper) CheckEnrollCode

func (siw *ServerInterfaceWrapper) CheckEnrollCode(c *gin.Context)

CheckEnrollCode operation middleware

func (*ServerInterfaceWrapper) CreateEnrollCode

func (siw *ServerInterfaceWrapper) CreateEnrollCode(c *gin.Context)

CreateEnrollCode operation middleware

func (*ServerInterfaceWrapper) CreateHost

func (siw *ServerInterfaceWrapper) CreateHost(c *gin.Context)

CreateHost operation middleware

func (*ServerInterfaceWrapper) CreateNetwork

func (siw *ServerInterfaceWrapper) CreateNetwork(c *gin.Context)

CreateNetwork operation middleware

func (*ServerInterfaceWrapper) CreateRule

func (siw *ServerInterfaceWrapper) CreateRule(c *gin.Context)

CreateRule operation middleware

func (*ServerInterfaceWrapper) DeleteHost

func (siw *ServerInterfaceWrapper) DeleteHost(c *gin.Context)

DeleteHost operation middleware

func (*ServerInterfaceWrapper) DeleteHostRule

func (siw *ServerInterfaceWrapper) DeleteHostRule(c *gin.Context)

DeleteHostRule operation middleware

func (*ServerInterfaceWrapper) DeleteNetwork

func (siw *ServerInterfaceWrapper) DeleteNetwork(c *gin.Context)

DeleteNetwork operation middleware

func (*ServerInterfaceWrapper) DeleteRule

func (siw *ServerInterfaceWrapper) DeleteRule(c *gin.Context)

DeleteRule operation middleware

func (*ServerInterfaceWrapper) EnrollHost

func (siw *ServerInterfaceWrapper) EnrollHost(c *gin.Context)

EnrollHost operation middleware

func (*ServerInterfaceWrapper) GetAllNetwork

func (siw *ServerInterfaceWrapper) GetAllNetwork(c *gin.Context)

GetAllNetwork operation middleware

func (*ServerInterfaceWrapper) GetHost

func (siw *ServerInterfaceWrapper) GetHost(c *gin.Context)

GetHost operation middleware

func (*ServerInterfaceWrapper) GetHostConfig

func (siw *ServerInterfaceWrapper) GetHostConfig(c *gin.Context)

GetHostConfig operation middleware

func (*ServerInterfaceWrapper) GetNetwork

func (siw *ServerInterfaceWrapper) GetNetwork(c *gin.Context)

GetNetwork operation middleware

func (*ServerInterfaceWrapper) GetUserInfo

func (siw *ServerInterfaceWrapper) GetUserInfo(c *gin.Context)

GetUserInfo operation middleware

func (*ServerInterfaceWrapper) ListHost

func (siw *ServerInterfaceWrapper) ListHost(c *gin.Context)

ListHost operation middleware

func (*ServerInterfaceWrapper) ListHostRules

func (siw *ServerInterfaceWrapper) ListHostRules(c *gin.Context)

ListHostRules operation middleware

func (*ServerInterfaceWrapper) ListRule

func (siw *ServerInterfaceWrapper) ListRule(c *gin.Context)

ListRule operation middleware

func (*ServerInterfaceWrapper) LoginUser

func (siw *ServerInterfaceWrapper) LoginUser(c *gin.Context)

LoginUser operation middleware

func (*ServerInterfaceWrapper) RegisterUser

func (siw *ServerInterfaceWrapper) RegisterUser(c *gin.Context)

RegisterUser operation middleware

func (*ServerInterfaceWrapper) SendCode

func (siw *ServerInterfaceWrapper) SendCode(c *gin.Context)

SendCode operation middleware

func (*ServerInterfaceWrapper) UpdateHost

func (siw *ServerInterfaceWrapper) UpdateHost(c *gin.Context)

UpdateHost operation middleware

func (*ServerInterfaceWrapper) UpdateNetwork

func (siw *ServerInterfaceWrapper) UpdateNetwork(c *gin.Context)

UpdateNetwork operation middleware

func (*ServerInterfaceWrapper) VerifyCode

func (siw *ServerInterfaceWrapper) VerifyCode(c *gin.Context)

VerifyCode operation middleware

type ShortHost

type ShortHost struct {
	CreatedAt string `json:"created_at"`

	// Id ID of the host
	Id         string `json:"id"`
	IpAddress  string `json:"ip_address"`
	LastSeenAt string `json:"last_seen_at"`
	Name       string `json:"name"`

	// Online Whether the host is online or not
	Online bool `json:"online"`
	Port   int  `json:"port"`

	// PublicIp Public IP address
	PublicIp string `json:"public_ip"`
}

ShortHost defines model for ShortHost.

type UpdateHostJSONBody

type UpdateHostJSONBody struct {
	// IpAddress 主机IP
	IpAddress string `json:"ip_address"`

	// Name 主机名称
	Name string `json:"name"`

	// Port 主机端口
	Port int `json:"port"`

	// PublicIp 公网IP
	PublicIp string `json:"public_ip"`
}

UpdateHostJSONBody defines parameters for UpdateHost.

type UpdateHostJSONRequestBody

type UpdateHostJSONRequestBody UpdateHostJSONBody

UpdateHostJSONRequestBody defines body for UpdateHost for application/json ContentType.

type UpdateNetworkJSONRequestBody

type UpdateNetworkJSONRequestBody = Network

UpdateNetworkJSONRequestBody defines body for UpdateNetwork for application/json ContentType.

type UserInfo

type UserInfo struct {
	Email       string `json:"email"`
	Id          string `json:"id"`
	LastLoginAt string `json:"last_login_at"`
}

UserInfo defines model for UserInfo.

type VerifyCodeParams

type VerifyCodeParams struct {
	// Email User email address
	Email openapi_types.Email `form:"email" json:"email"`

	// Code Verification code
	Code string `form:"code" json:"code"`
}

VerifyCodeParams defines parameters for VerifyCode.

Jump to

Keyboard shortcuts

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