bunny

package
v0.0.1-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BunnyClient

type BunnyClient struct {
	// contains filtered or unexported fields
}

func (*BunnyClient) CreateRecord

func (c *BunnyClient) CreateRecord(ctx context.Context, zoneID string, r CreateRecordRequest) (*Record, error)

func (*BunnyClient) DeleteRecord

func (c *BunnyClient) DeleteRecord(ctx context.Context, zoneID int64, recordID int64) error

func (*BunnyClient) ListZones

func (*BunnyClient) UpdateRecord

func (c *BunnyClient) UpdateRecord(ctx context.Context, zoneID int64, recordID int64, r UpdateRecordRequest) error

type Client

type Client interface {
	ListZones(ctx context.Context, r ListZonesRequest) (*ListZonesResponse, error)
	CreateRecord(ctx context.Context, zoneID string, r CreateRecordRequest) (*Record, error)
	UpdateRecord(ctx context.Context, zoneID int64, recordID int64, r UpdateRecordRequest) error
	DeleteRecord(ctx context.Context, zoneID int64, recordID int64) error
}

func NewDNSClient

func NewDNSClient(
	doer HTTPDoer,
	apiKey string,
) Client

type CreateRecordRequest

type CreateRecordRequest struct {
	Type       RecordType `json:"Type"`
	TTLSeconds int        `json:"Ttl"`
	Value      string     `json:"Value"`
	Name       string     `json:"Name"`
}

type HTTPDoer

type HTTPDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

type ListZonesRequest

type ListZonesRequest struct {
	Page    int    // Page number
	PerPage int    // Number of records per page
	Domain  string // Filter by domain
}

type ListZonesResponse

type ListZonesResponse struct {
	Items        []*Zone `json:"Items"`
	CurrentPage  int     `json:"CurrentPage"`
	TotalItems   int     `json:"TotalItems"`
	HasMoreItems bool    `json:"HasMoreItems"`
}

type Options

type Options struct {
	APIKey               string   `env:"API_KEY, required"`
	DryRun               bool     `env:"DRY_RUN, default=false"`
	ExcludeDomains       []string `env:"EXCLUDE_DOMAINS"`
	ExcludeDomainsRegexp string   `env:"EXCLUDE_DOMAINS_REGEXP"`
	IncludeDomains       []string `env:"INCLUDE_DOMAINS"`
	IncludeDomainsRegexp string   `env:"INCLUDE_DOMAINS_REGEXP"`
}

type Provider

type Provider struct {
	Options Options
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(client Client, options Options) *Provider

func (*Provider) AdjustEndpoints

func (p *Provider) AdjustEndpoints(incoming []*endpoint.Endpoint) ([]*endpoint.Endpoint, error)

AdjustEndpoints canonicalizes a set of candidate endpoints. It is called with a set of candidate endpoints obtained from the various sources. It returns a set modified as required by the provider. The provider is responsible for adding, removing, and modifying the ProviderSpecific properties to match the endpoints that the provider returns in `Records` so that the change plan will not have unnecessary (potentially failing) changes. It may also modify other fields, add, or remove Endpoints. It is permitted to modify the supplied endpoints.

func (*Provider) ApplyChanges

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

func (*Provider) GetDomainFilter

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

GetDomainFilter returns the domain filter used by this provider.

func (*Provider) Records

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

type Record

type Record struct {
	ID                    int64      `json:"Id"`
	Type                  RecordType `json:"Type"`
	TTLSeconds            int        `json:"Ttl"`
	Value                 string     `json:"Value"`
	Name                  string     `json:"Name"`
	Weight                int        `json:"Weight"`
	Priority              int        `json:"Priority"`
	Port                  int        `json:"Port"`
	Flags                 int        `json:"Flags"`
	Tag                   string     `json:"Tag"`
	Accelerated           bool       `json:"Accelerated"`
	AcceleratedPullZoneID int64      `json:"AcceleratedPullZoneId"`
	LinkName              string     `json:"LinkName"`
	Disabled              bool       `json:"Disabled"`
	Comment               string     `json:"Comment"`
}

type RecordType

type RecordType int
const (
	RecordTypeA RecordType = iota
	RecordTypeAAAA
	RecordTypeCNAME
	RecordTypeTXT
	RecordTypeMX
	RecordTypeRDR
	RecordTypeFlatten
	RecordTypePZ
	RecordTypeSRV
	RecordTypeCAA
	RecordTypePTR
	RecordTypeSCR
	RecordTypeNS
)

func RecordTypeFromString

func RecordTypeFromString(s string) RecordType

func (RecordType) String

func (r RecordType) String() string

type UpdateRecordRequest

type UpdateRecordRequest struct {
	TTLSeconds int    `json:"Ttl"`
	Value      string `json:"Value"`
}

type Zone

type Zone struct {
	ID      int64     `json:"Id"`
	Domain  string    `json:"Domain"`
	Records []*Record `json:"Records"`
}

Jump to

Keyboard shortcuts

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