cloudflare

package
v0.72.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 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)
	ListDNSRecords(ctx context.Context, rc *cf.ResourceContainer, params cf.ListDNSRecordsParams) ([]cf.DNSRecord, *cf.ResultInfo, error)
	CreateDNSRecord(ctx context.Context, rc *cf.ResourceContainer, params cf.CreateDNSRecordParams) (cf.DNSRecord, error)
	UpdateDNSRecord(ctx context.Context, rc *cf.ResourceContainer, params cf.UpdateDNSRecordParams) (cf.DNSRecord, error)
	DeleteDNSRecord(ctx context.Context, rc *cf.ResourceContainer, 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, rc *cf.ResourceContainer, params cf.CreateDNSRecordParams) (cf.DNSRecord, error)

CreateDNSRecord mocks cloudflare package same method

func (*MockCloudflare) DeleteDNSRecord

func (c *MockCloudflare) DeleteDNSRecord(ctx context.Context, rc *cf.ResourceContainer, recordID string) error

DeleteDNSRecord mocks cloudflare package same method

func (*MockCloudflare) ListDNSRecords added in v0.72.0

DNSRecords mocks cloudflare package same method

func (*MockCloudflare) UpdateDNSRecord added in v0.56.0

func (c *MockCloudflare) UpdateDNSRecord(ctx context.Context, rc *cf.ResourceContainer, params cf.UpdateDNSRecordParams) (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