firewall

package
v0.43.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MPL-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	firewall.API
	SecurityGroup
	Options
	SecurityGroup(group string) firewall.Rule
}

API is an interface for managing cluster firewall.

type Client

type Client struct {
	firewall.Client
}

Client is an interface for accessing the Proxmox cluster firewall API.

func (*Client) CreateGroup

func (c *Client) CreateGroup(ctx context.Context, d *GroupCreateRequestBody) error

CreateGroup create new security group.

func (*Client) DeleteGroup

func (c *Client) DeleteGroup(ctx context.Context, group string) error

DeleteGroup delete security group.

func (*Client) GetGlobalOptions

func (c *Client) GetGlobalOptions(ctx context.Context) (*OptionsGetResponseData, error)

GetGlobalOptions retrieves the global firewall options.

func (*Client) ListGroups

func (c *Client) ListGroups(ctx context.Context) ([]*GroupListResponseData, error)

ListGroups retrieve list of security groups.

func (*Client) SecurityGroup

func (c *Client) SecurityGroup(group string) firewall.Rule

SecurityGroup returns a client for managing a specific security group.

func (*Client) SetGlobalOptions

func (c *Client) SetGlobalOptions(ctx context.Context, d *OptionsPutRequestBody) error

SetGlobalOptions sets the global firewall options.

func (*Client) UpdateGroup

func (c *Client) UpdateGroup(ctx context.Context, d *GroupUpdateRequestBody) error

UpdateGroup update security group.

type CustomLogRateLimit

type CustomLogRateLimit struct {
	Enable types.CustomBool `json:"enable,omitempty" url:"enable,omitempty,int"`
	Burst  *int             `json:"burst,omitempty"  url:"burst,omitempty,int"`
	Rate   *string          `json:"rate,omitempty"   url:"rate,omitempty"`
}

CustomLogRateLimit is a custom type for the log_ratelimit field of the firewall optionss.

func (*CustomLogRateLimit) EncodeValues

func (r *CustomLogRateLimit) EncodeValues(key string, v *url.Values) error

EncodeValues converts a CustomWatchdogDevice struct to a URL vlaue.

func (*CustomLogRateLimit) UnmarshalJSON

func (r *CustomLogRateLimit) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a CustomLogRateLimit struct from JSON.

type GroupCreateRequestBody

type GroupCreateRequestBody struct {
	Group   string  `json:"group"             url:"group"`
	Comment *string `json:"comment,omitempty" url:"comment,omitempty"`
	Digest  *string `json:"digest,omitempty"  url:"digest,omitempty"`
}

GroupCreateRequestBody contains the data for a security group create request.

type GroupListResponseBody

type GroupListResponseBody struct {
	Data []*GroupListResponseData `json:"data,omitempty"`
}

GroupListResponseBody contains the data from a group get response.

type GroupListResponseData

type GroupListResponseData struct {
	Comment *string `json:"comment,omitempty" url:"comment,omitempty"`
	Group   string  `json:"group"             url:"group"`
	Digest  string  `json:"digest"            url:"digest"`
}

GroupListResponseData contains the data from a group list response.

type GroupUpdateRequestBody

type GroupUpdateRequestBody struct {
	Group string `json:"group" url:"group"`

	Comment *string `json:"comment,omitempty" url:"comment,omitempty"`
	ReName  *string `json:"rename,omitempty"  url:"rename,omitempty"`
	Digest  *string `json:"digest,omitempty"  url:"digest,omitempty"`
}

GroupUpdateRequestBody contains the data for a group update request.

type Options

type Options interface {
	SetGlobalOptions(ctx context.Context, d *OptionsPutRequestBody) error
	GetGlobalOptions(ctx context.Context) (*OptionsGetResponseData, error)
}

Options is an interface for managing global firewall options.

type OptionsGetResponseBody

type OptionsGetResponseBody struct {
	Data *OptionsGetResponseData `json:"data,omitempty"`
}

OptionsGetResponseBody is the response body for the GET /cluster/firewall/options API call.

type OptionsGetResponseData

type OptionsGetResponseData struct {
	EBTables     *types.CustomBool   `json:"ebtables"      url:"ebtables, int"`
	Enable       *types.CustomBool   `json:"enable"        url:"enable,int"`
	LogRateLimit *CustomLogRateLimit `json:"log_ratelimit" url:"log_ratelimit"`
	PolicyIn     *string             `json:"policy_in"     url:"policy_in"`
	PolicyOut    *string             `json:"policy_out"    url:"policy_out"`
}

OptionsGetResponseData is the data field of the response body for the GET /cluster/firewall/options API call.

type OptionsPutRequestBody

type OptionsPutRequestBody struct {
	EBTables     *types.CustomBool   `json:"ebtables,omitempty"      url:"ebtables,omitempty,int"`
	Enable       *types.CustomBool   `json:"enable,omitempty"        url:"enable,omitempty,int"`
	LogRateLimit *CustomLogRateLimit `json:"log_ratelimit,omitempty" url:"log_ratelimit,omitempty"`
	PolicyIn     *string             `json:"policy_in,omitempty"     url:"policy_in,omitempty"`
	PolicyOut    *string             `json:"policy_out,omitempty"    url:"policy_out,omitempty"`
}

OptionsPutRequestBody is the request body for the PUT /cluster/firewall/options API call.

type SecurityGroup

type SecurityGroup interface {
	CreateGroup(ctx context.Context, d *GroupCreateRequestBody) error
	ListGroups(ctx context.Context) ([]*GroupListResponseData, error)
	UpdateGroup(ctx context.Context, d *GroupUpdateRequestBody) error
	DeleteGroup(ctx context.Context, group string) error
}

SecurityGroup is an interface for the Proxmox security group API.

Jump to

Keyboard shortcuts

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