unifi

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatUrl

func FormatUrl(path string, params ...string) string

FormatUrl formats a URL with the given parameters.

func NewUnifiProvider

func NewUnifiProvider(domainFilter endpoint.DomainFilter, config *Config) (provider.Provider, error)

NewUnifiProvider initializes a new DNSProvider.

Types

type ClientURLs

type ClientURLs struct {
	Login   string
	Records string
}

type Config

type Config struct {
	Host               string `env:"UNIFI_HOST,notEmpty"`
	ApiKey             string `env:"UNIFI_API_KEY" envDefault:""`
	User               string `env:"UNIFI_USER" envDefault:""`
	Password           string `env:"UNIFI_PASS" envDefault:""`
	Site               string `env:"UNIFI_SITE" envDefault:"default"`
	ExternalController bool   `env:"UNIFI_EXTERNAL_CONTROLLER" envDefault:"false"`
	SkipTLSVerify      bool   `env:"UNIFI_SKIP_TLS_VERIFY" envDefault:"true"`
}

Config represents the configuration for the UniFi API.

type DNSRecord

type DNSRecord struct {
	ID         string       `json:"_id,omitempty"`
	Enabled    bool         `json:"enabled,omitempty"`
	Key        string       `json:"key"`
	Port       *int         `json:"port,omitempty"`
	Priority   *int         `json:"priority,omitempty"`
	RecordType string       `json:"record_type"`
	TTL        endpoint.TTL `json:"ttl,omitempty"`
	Value      string       `json:"value"`
	Weight     *int         `json:"weight,omitempty"`
}

DNSRecord represents a DNS record in the UniFi API.

type Login

type Login struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Remember bool   `json:"remember"`
}

Login represents a login request to the UniFi API.

type Provider

type Provider struct {
	provider.BaseProvider
	// contains filtered or unexported fields
}

Provider type for interfacing with UniFi

func (*Provider) ApplyChanges

func (p *Provider) ApplyChanges(ctx context.Context, changes *plan.Changes) error

ApplyChanges applies a given set of changes in the DNS provider.

func (*Provider) GetDomainFilter

func (p *Provider) GetDomainFilter() endpoint.DomainFilterInterface

GetDomainFilter returns the domain filter for the provider.

func (*Provider) Records

func (p *Provider) Records(ctx context.Context) ([]*endpoint.Endpoint, error)

Records returns the list of records in the DNS provider.

type UnifiErrorResponse

type UnifiErrorResponse struct {
	Code      string                 `json:"code"`
	Details   map[string]interface{} `json:"details"`
	ErrorCode int                    `json:"errorCode"`
	Message   string                 `json:"message"`
}

Jump to

Keyboard shortcuts

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