Documentation
¶
Index ¶
- Variables
- type Client
- func (client *Client) CreateIfNotExists(publicPortStart, publicPortEnd int, zone string) (int, error)
- func (client *Client) Erase(publicPort int, zone string) error
- func (client *Client) ExcludePortRange(start, end int) *Client
- func (client *Client) GetOrLeaseAny(privatePort int, vmID, zone string) (*model.VmPort, error)
- func (client *Client) IncludePortRange(start, end int) *Client
- func (client *Client) Lease(publicPort, privatePort int, vmID, zone string) (*model.VmPort, error)
- func (client *Client) ReleaseAll(vmID string) error
- func (client *Client) WithPagination(page, pageSize int) *Client
- func (client *Client) WithVmID(vmID string) *Client
- func (client *Client) WithZone(zone string) *Client
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrPortNotFound is returned when a port is not found. ErrPortNotFound = errors.New("port not found") // ErrNoPortsAvailable is returned when no ports are available. // This is likely due to the port range being full. ErrNoPortsAvailable = errors.New("port not found") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Collection *mongo.Collection base_clients.ResourceClient[model.VmPort] }
Client is the client for VM ports.
func (*Client) CreateIfNotExists ¶
func (client *Client) CreateIfNotExists(publicPortStart, publicPortEnd int, zone string) (int, error)
CreateIfNotExists creates the given port range if it does not already exist.
func (*Client) ExcludePortRange ¶
ExcludePortRange adds a filter to the client to exclude VM ports in the given range.
func (*Client) GetOrLeaseAny ¶
GetOrLeaseAny gets a port that is not leased, or leases a port for the given VM.
func (*Client) IncludePortRange ¶
IncludePortRange adds a filter to the client to only return VM ports in the given range.
func (*Client) ReleaseAll ¶
ReleaseAll releases all ports leased by the given VM.
func (*Client) WithPagination ¶
WithPagination sets the pagination for the client.
Click to show internal directories.
Click to hide internal directories.