definednet

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteHost

func DeleteHost(ctx context.Context, client Client, req DeleteHostRequest) error

DeleteHost deletes a Defined.net host.

Types

type Client

type Client interface {
	Do(ctx context.Context, method string, path []string, request, response any) error
}

Client is a Defined.net HTTP API client.

func NewClient

func NewClient(endpoint, token string) (Client, error)

NewClient creates a Defined.net HTTP API client.

type ConfigOverride added in v0.1.3

type ConfigOverride struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

ConfigOverride is a data model for Defined.net host configuration override.

type CreateEnrollmentRequest

type CreateEnrollmentRequest struct {
	NetworkID       string           `json:"networkID"`
	RoleID          string           `json:"roleID,omitempty"`
	Name            string           `json:"name"`
	StaticAddresses []string         `json:"staticAddresses"`
	ListenPort      int              `json:"listenPort"`
	IsLighthouse    bool             `json:"isLighthouse"`
	IsRelay         bool             `json:"isRelay"`
	Tags            []string         `json:"tags"`
	ConfigOverrides []ConfigOverride `json:"configOverrides"`
}

CreateEnrollmentRequest is a request data model for CreateEnrollment endpoint.

type DeleteHostRequest

type DeleteHostRequest struct {
	ID string
}

DeleteHostRequest is a request data model for DeleteHost endpoint.

type Enrollment

type Enrollment struct {
	Host           Host           `json:"host"`
	EnrollmentCode EnrollmentCode `json:"enrollmentCode"`
}

Enrollment is a data model for Defined.net host enrollment.

func CreateEnrollment

func CreateEnrollment(ctx context.Context, client Client, req CreateEnrollmentRequest) (*Enrollment, error)

CreateEnrollment creates a Defined.net host enrollment.

type EnrollmentCode

type EnrollmentCode struct {
	Code            string `json:"code"`
	LifetimeSeconds int    `json:"lifetimeSeconds"`
}

EnrollmentCode is a data model for Defined.net host enrollment code.

type GetHostRequest

type GetHostRequest struct {
	ID string
}

GetHostRequest is a request data model for GetHost endpoint.

type Host

type Host struct {
	ID              string           `json:"id"`
	NetworkID       string           `json:"networkID"`
	RoleID          string           `json:"roleID,omitempty"`
	Name            string           `json:"name"`
	IPAddress       string           `json:"ipAddress"`
	StaticAddresses []string         `json:"staticAddresses"`
	ListenPort      int              `json:"listenPort"`
	IsLighthouse    bool             `json:"isLighthouse"`
	IsRelay         bool             `json:"isRelay"`
	Tags            []string         `json:"tags"`
	ConfigOverrides []ConfigOverride `json:"configOverrides"`
}

Host is a data model for Defined.net host.

func GetHost

func GetHost(ctx context.Context, client Client, req GetHostRequest) (*Host, error)

GetHost retrieves a Defined.net host.

func UpdateHost

func UpdateHost(ctx context.Context, client Client, req UpdateHostRequest) (*Host, error)

UpdateHost updates a Defined.net host.

type Response

type Response[D any] struct {
	Data D `json:"data"`
}

Response is a generic data model for Defined.net responses.

type UpdateHostRequest

type UpdateHostRequest struct {
	ID              string           `json:"-"`
	RoleID          string           `json:"roleID,omitempty"`
	Name            string           `json:"name"`
	StaticAddresses []string         `json:"staticAddresses"`
	ListenPort      int              `json:"listenPort"`
	Tags            []string         `json:"tags"`
	ConfigOverrides []ConfigOverride `json:"configOverrides"`
}

UpdateHostRequest is a request data model for UpdateHost endpoint.

Jump to

Keyboard shortcuts

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