cloudflare

package
v0.69.4 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSClient

type AWSClient interface {
	GetPublicHostedZoneNames() []string
}

AWSClient interface that holds AWS client function

type Client

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

Client is a wrapper on to of Cloudflare library client.

func NewClientWithToken

func NewClientWithToken(client Cloudflarer, aws AWSClient) *Client

NewClientWithToken creates a new client that can be used to run the other functions.

func (*Client) CreateDNSRecords

func (c *Client) CreateDNSRecords(dnsNames []string, dnsEndpoints []string, logger logrus.FieldLogger) error

CreateDNSRecords creates a DNS records in the first given Cloudflare zone name of the list

func (*Client) DeleteDNSRecords

func (c *Client) DeleteDNSRecords(dnsNames []string, logger logrus.FieldLogger) error

DeleteDNSRecords gets DNS name and zone name which uses to delete that DNS record from Cloudflare

type Cloudflarer

type Cloudflarer interface {
	ZoneIDByName(zoneName string) (string, error)
	DNSRecords(ctx context.Context, zoneID string, rr cf.DNSRecord) ([]cf.DNSRecord, error)
	CreateDNSRecord(ctx context.Context, zoneID string, rr cf.DNSRecord) (*cf.DNSRecordResponse, error)
	UpdateDNSRecord(ctx context.Context, zoneID, recordID string, rr cf.DNSRecord) error
	DeleteDNSRecord(ctx context.Context, zoneID, recordID string) error
}

Cloudflarer interface that holds Cloudflare functions

type MockAWSClient

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

MockAWSClient mocks the AWS client interface

func (*MockAWSClient) GetPublicHostedZoneNames

func (a *MockAWSClient) GetPublicHostedZoneNames() []string

GetPublicHostedZoneNames mocks AWS client method

type MockCloudflare

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

MockCloudflare mocks the Cloudflarer interface

func (*MockCloudflare) CreateDNSRecord

func (c *MockCloudflare) CreateDNSRecord(ctx context.Context, zoneID string, rr cf.DNSRecord) (*cf.DNSRecordResponse, error)

CreateDNSRecord mocks cloudflare package same method

func (*MockCloudflare) DNSRecords

func (c *MockCloudflare) DNSRecords(ctx context.Context, zoneID string, rr cf.DNSRecord) ([]cf.DNSRecord, error)

DNSRecords mocks cloudflare package same method

func (*MockCloudflare) DeleteDNSRecord

func (c *MockCloudflare) DeleteDNSRecord(ctx context.Context, zoneID, recordID string) error

DeleteDNSRecord mocks cloudflare package same method

func (*MockCloudflare) UpdateDNSRecord added in v0.56.0

func (c *MockCloudflare) UpdateDNSRecord(ctx context.Context, zoneID, recordID string, rr cf.DNSRecord) error

UpdateDNSRecord mocks cloudflare package same method

func (*MockCloudflare) ZoneIDByName

func (c *MockCloudflare) ZoneIDByName(zoneName string) (string, error)

ZoneIDByName mocks the getZoneID

type NoopCloudflarer

type NoopCloudflarer struct{}

NoopCloudflarer is used as a dummy Cloudflarer interface

func NoopClient

func NoopClient() *NoopCloudflarer

NoopClient returns an empty noopCloudflarer struct

func (*NoopCloudflarer) CreateDNSRecords

func (*NoopCloudflarer) CreateDNSRecords(_ []string, _ []string, logger logrus.FieldLogger) error

CreateDNSRecords returns an empty dummy func for noopCloudflarer

func (*NoopCloudflarer) DeleteDNSRecords

func (*NoopCloudflarer) DeleteDNSRecords(_ []string, logger logrus.FieldLogger) error

DeleteDNSRecords returns an empty dummy func for noopCloudflarer

Jump to

Keyboard shortcuts

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