provider

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrZoneAlreadyExists error returned when zone cannot be created when it already exists
	ErrZoneAlreadyExists = errors.New("specified zone already exists")
	// ErrZoneNotFound error returned when specified zone does not exists
	ErrZoneNotFound = errors.New("specified zone not found")
	// ErrRecordAlreadyExists when create request is sent but record already exists
	ErrRecordAlreadyExists = errors.New("record already exists")
	// ErrRecordNotFound when update/delete request is sent but record not found
	ErrRecordNotFound = errors.New("record not found")
	// ErrInvalidBatchRequest when record is repeated in create/update/delete
	ErrInvalidBatchRequest = errors.New("record should only be specified in one list")
)

Functions

This section is empty.

Types

type AWSProvider

type AWSProvider struct {
	Client Route53API
	DryRun bool
}

AWSProvider is an implementation of Provider for AWS Route53.

func (*AWSProvider) ApplyChanges

func (p *AWSProvider) ApplyChanges(zone string, changes *plan.Changes) error

ApplyChanges applies a given set of changes in a given zone.

func (*AWSProvider) CreateRecords

func (p *AWSProvider) CreateRecords(zone string, endpoints []endpoint.Endpoint) error

CreateRecords creates a given set of DNS records in the given hosted zone.

func (*AWSProvider) CreateZone

func (p *AWSProvider) CreateZone(name string) (*route53.HostedZone, error)

CreateZone creates a hosted zone given a name.

func (*AWSProvider) DeleteRecords

func (p *AWSProvider) DeleteRecords(zone string, endpoints []endpoint.Endpoint) error

DeleteRecords deletes a given set of DNS records in a given zone.

func (*AWSProvider) DeleteZone

func (p *AWSProvider) DeleteZone(name string) error

DeleteZone deletes a hosted zone given a name.

func (*AWSProvider) Records

func (p *AWSProvider) Records(zone string) ([]endpoint.Endpoint, error)

Records returns the list of records in a given hosted zone.

func (*AWSProvider) UpdateRecords

func (p *AWSProvider) UpdateRecords(zone string, endpoints, _ []endpoint.Endpoint) error

UpdateRecords updates a given set of old records to a new set of records in a given hosted zone.

func (*AWSProvider) Zone

func (p *AWSProvider) Zone(dnsName string) (*route53.HostedZone, error)

Zone returns a single zone given a DNS name.

func (*AWSProvider) Zones

func (p *AWSProvider) Zones() ([]string, error)

Zones returns the list of hosted zones.

type InMemoryProvider

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

InMemoryProvider - dns provider only used for testing purposes initialized as dns provider with no records

func NewInMemoryProvider

func NewInMemoryProvider() *InMemoryProvider

NewInMemoryProvider returns InMemoryProvider DNS provider interface implementation

func (*InMemoryProvider) ApplyChanges

func (im *InMemoryProvider) ApplyChanges(zone string, changes *plan.Changes) error

ApplyChanges simply modifies records in memory error checking occurs before any modifications are made, i.e. batch processing create record - record should not exist update/delete record - record should exist create/update/delete lists should not have overlapping records

func (*InMemoryProvider) CreateZone

func (im *InMemoryProvider) CreateZone(newZone string) error

CreateZone adds new zone if not present

func (*InMemoryProvider) Records

func (im *InMemoryProvider) Records(zone string) ([]endpoint.Endpoint, error)

Records returns the list of endpoints

type InMemoryRecord

type InMemoryRecord struct {
	Type    string
	Payload string
	endpoint.Endpoint
}

InMemoryRecord - record stored in memory has additional fields: Type - type of string (TODO: Type should probably be part of endpoint struct) Payload - string - additional information stored

type Provider

type Provider interface {
	Records(zone string) ([]endpoint.Endpoint, error)
	ApplyChanges(zone string, changes *plan.Changes) error
}

Provider defines the interface DNS providers should implement.

func NewAWSProvider

func NewAWSProvider(dryRun bool) (Provider, error)

NewAWSProvider initializes a new AWS Route53 based Provider.

func NewGoogleProvider

func NewGoogleProvider(project string, dryRun bool) (Provider, error)

NewGoogleProvider initializes a new Google CloudDNS based Provider.

type Route53API

type Route53API interface {
	ListResourceRecordSetsPages(input *route53.ListResourceRecordSetsInput, fn func(resp *route53.ListResourceRecordSetsOutput, lastPage bool) (shouldContinue bool)) error
	ChangeResourceRecordSets(*route53.ChangeResourceRecordSetsInput) (*route53.ChangeResourceRecordSetsOutput, error)
	ListHostedZonesPages(input *route53.ListHostedZonesInput, fn func(resp *route53.ListHostedZonesOutput, lastPage bool) (shouldContinue bool)) error
	ListHostedZonesByName(input *route53.ListHostedZonesByNameInput) (*route53.ListHostedZonesByNameOutput, error)
	CreateHostedZone(*route53.CreateHostedZoneInput) (*route53.CreateHostedZoneOutput, error)
	DeleteHostedZone(*route53.DeleteHostedZoneInput) (*route53.DeleteHostedZoneOutput, error)
}

Route53API is the subset of the AWS Route53 API that we actually use. Add methods as required. Signatures must match exactly. mostly taken from: https://github.com/kubernetes/kubernetes/blob/853167624edb6bc0cfdcdfb88e746e178f5db36c/federation/pkg/dnsprovider/providers/aws/route53/stubs/route53api.go

Jump to

Keyboard shortcuts

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