cloudflare

package
v0.0.0-...-2b6d021 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

README

cloudflare

A provider for (initially) basic interactions with cloudflare DNS to support partners that are using cloudflare.

Example:

    p, err := cloudflare.NewProviderFromConfig(&cloudflare.Config{
        // the name of a DNS zone in
        // cloudflare, the Select process
        // will scan and find the appropriate ID
		Zone:  "wutangclan.com",

        // the name of the A record to create
		Name:  "gza",

        // the IP value
		Value: "121.21.2.1",

        // (optional) TTL - will default to 1 (auto)
        // if left empty
		TTL:   1,
	})

	if err != nil {

		return err
	}

	err = p.Apply()
	if err != nil {
		return err
	}

Documentation

Index

Constants

View Source
const (
	DefaultTTL  = 1
	DefaultType = "A"
)

Variables

This section is empty.

Functions

func NewProvider

func NewProvider(req *pb.CreateRequest) providers.Provider

NewProvider initializes a CloudflareProvider with defaults

func NewProviderFromConfig

func NewProviderFromConfig(cfg *Config) (providers.Provider, error)

func NewRegistrationProvider

func NewRegistrationProvider(req *pb.Registration) providers.Provider

NewRegistrationProvider initializes a CloudflareProvider for use with a registration callback vs a full blown provider implementation, extracting and mapping the correct part of the request configuration

Types

type CloudflareProvider

type CloudflareProvider struct {
	// Config holds our internal configuration options
	// for the instance of the CloudflareProvider
	Config *Config

	Zone    cloudflare.Zone
	Records []cloudflare.DNSRecord
	// contains filtered or unexported fields
}

CloudflareProvider implements a CloudflareProvider

func (*CloudflareProvider) Annotate

func (p *CloudflareProvider) Annotate(id string, l labels.Labels) error

Annotate should implement applying labels or tags for a given resource type

func (*CloudflareProvider) Apply

func (p *CloudflareProvider) Apply() error

Apply runs the CloudflareProvider end to end which in this instance is only associated with creating a dns record

func (*CloudflareProvider) AwaitReadiness

func (p *CloudflareProvider) AwaitReadiness() chan error

AwaitReadiness should be implemented to detect when a CloudflareProvider has finished setting up a variant and can begin using it in an experiment

func (*CloudflareProvider) Cancel

func (p *CloudflareProvider) Cancel() error

Cancel will abort and running or submitted CloudflareProvider

func (*CloudflareProvider) Clone

func (p *CloudflareProvider) Clone() error

Clone creates a modified variant

func (*CloudflareProvider) ProbeReadiness

func (p *CloudflareProvider) ProbeReadiness() (bool, error)

ProbeReadiness checks that the provisioned resource is available and ready to be included in a request

func (*CloudflareProvider) Read

func (p *CloudflareProvider) Read() error

Read fetches and stores the configuration for an existing cloudflare zone. What is read of the existing resource acts as the template/configuration to implement a clone via creating a new resource with the existing output as input for a variant

func (*CloudflareProvider) Select

func (p *CloudflareProvider) Select() (target.Selection, error)

Select is similar to Read yet copies a selection of resources based on the Target configuration

func (*CloudflareProvider) Stop

func (p *CloudflareProvider) Stop() error

Stop will stop any running CloudflareProvider

func (*CloudflareProvider) Teardown

func (p *CloudflareProvider) Teardown() error

Teardown eradicates any resource that has been provisioned as part of a variant

type Config

type Config struct {
	Zone   string
	ZoneID string
	Name   string
	TTL    int
	Value  string
	Type   string
}

Config holds allowed values for an implemented resource provider. Any value outside of this config is unable to be modified during resource creation.

func DefaultConfig

func DefaultConfig() *Config

func MergeDefaultConfig

func MergeDefaultConfig(cfg *Config) *Config

Jump to

Keyboard shortcuts

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