provider

package
v0.0.0-...-8007e43 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2017 Nho Luong DevOps.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var RecordsContextKey = &contextKey{"records"}

RecordsContextKey is a context key. It can be used during ApplyChanges to access previously cached records. The associated value will be of type []*endpoint.Endpoint.

View Source
var SoftError error = errors.New("soft error")

SoftError is an error, that provider will only log as error instead of fatal. It is meant for error propagation from providers to tell that this is a transient error.

Functions

func Difference

func Difference(current, desired []string) ([]string, []string, []string)

Difference tells which entries need to be respectively added, removed, or left untouched for "current" to be transformed to "desired"

func EnsureTrailingDot

func EnsureTrailingDot(hostname string) string

EnsureTrailingDot ensures that the hostname receives a trailing dot if it hasn't already.

func NewSoftError

func NewSoftError(err error) error

NewSoftError creates a SoftError from the given error

func SupportedRecordType

func SupportedRecordType(recordType string) bool

SupportedRecordType returns true only for supported record types. Currently A, AAAA, CNAME, SRV, TXT and NS record types are supported.

Types

type BaseProvider

type BaseProvider struct{}

func (BaseProvider) AdjustEndpoints

func (b BaseProvider) AdjustEndpoints(endpoints []*endpoint.Endpoint) ([]*endpoint.Endpoint, error)

func (BaseProvider) GetDomainFilter

func (b BaseProvider) GetDomainFilter() endpoint.DomainFilterInterface

type CachedProvider

type CachedProvider struct {
	Provider
	RefreshDelay time.Duration
	// contains filtered or unexported fields
}

func NewCachedProvider

func NewCachedProvider(provider Provider, refreshDelay time.Duration) *CachedProvider

func (*CachedProvider) ApplyChanges

func (c *CachedProvider) ApplyChanges(ctx context.Context, changes *plan.Changes) error

func (*CachedProvider) Records

func (c *CachedProvider) Records(ctx context.Context) ([]*endpoint.Endpoint, error)

func (*CachedProvider) Reset

func (c *CachedProvider) Reset()

type Provider

type Provider interface {
	Records(ctx context.Context) ([]*endpoint.Endpoint, error)
	ApplyChanges(ctx context.Context, changes *plan.Changes) 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.
	AdjustEndpoints(endpoints []*endpoint.Endpoint) ([]*endpoint.Endpoint, error)
	GetDomainFilter() endpoint.DomainFilterInterface
}

Provider defines the interface DNS providers should implement.

type ZoneIDFilter

type ZoneIDFilter struct {
	ZoneIDs []string
}

ZoneIDFilter holds a list of zone ids to filter by

func NewZoneIDFilter

func NewZoneIDFilter(zoneIDs []string) ZoneIDFilter

NewZoneIDFilter returns a new ZoneIDFilter given a list of zone ids

func (ZoneIDFilter) IsConfigured

func (f ZoneIDFilter) IsConfigured() bool

IsConfigured returns true if DomainFilter is configured, false otherwise

func (ZoneIDFilter) Match

func (f ZoneIDFilter) Match(zoneID string) bool

Match checks whether a zone matches one of the provided zone ids

type ZoneIDName

type ZoneIDName map[string]string

func (ZoneIDName) Add

func (z ZoneIDName) Add(zoneID, zoneName string)

func (ZoneIDName) FindZone

func (z ZoneIDName) FindZone(hostname string) (suitableZoneID, suitableZoneName string)

type ZoneTagFilter

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

ZoneTagFilter holds a list of zone tags to filter by

func NewZoneTagFilter

func NewZoneTagFilter(tags []string) ZoneTagFilter

NewZoneTagFilter returns a new ZoneTagFilter given a list of zone tags

func (ZoneTagFilter) IsEmpty

func (f ZoneTagFilter) IsEmpty() bool

IsEmpty returns true if there are no tags for the filter

func (ZoneTagFilter) Match

func (f ZoneTagFilter) Match(tagsMap map[string]string) bool

Match checks whether a zone's set of tags matches the provided tag values

type ZoneTypeFilter

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

ZoneTypeFilter holds a zone type to filter for.

func NewZoneTypeFilter

func NewZoneTypeFilter(zoneType string) ZoneTypeFilter

NewZoneTypeFilter returns a new ZoneTypeFilter given a zone type to filter for.

func (ZoneTypeFilter) Match

func (f ZoneTypeFilter) Match(rawZoneType interface{}) bool

Match checks whether a zone matches the zone type that's filtered for.

Jump to

Keyboard shortcuts

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