Documentation ¶
Index ¶
- type Cloudflare
- func (c *Cloudflare) AddRecord(zoneID string, t, name, content, comment string, proxied bool) (*Record, error)
- func (c *Cloudflare) DeleteRecord(zoneID string, id string) error
- func (c *Cloudflare) FilterRecords(records []*Record, filters ...RecordFilter) []*Record
- func (c *Cloudflare) GetRecords(zoneID string, filters ...RecordFilter) ([]*Record, error)
- func (c *Cloudflare) GetZones(filters ...ZoneFilter) (map[string]string, error)
- func (c *Cloudflare) Poll(ctx context.Context, interval time.Duration) <-chan error
- func (c *Cloudflare) Records() map[string]*Record
- func (c *Cloudflare) SetAllowedZones(names ...string)
- func (c *Cloudflare) UpdateRecordAddress(zoneID string, id, address string) error
- func (c *Cloudflare) ZoneID(name string) (string, error)
- type Record
- type RecordFilter
- type ZoneFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cloudflare ¶
type Cloudflare struct {
// contains filtered or unexported fields
}
func NewCloudflare ¶
func NewCloudflare(zoneKey, dnsKey string) (*Cloudflare, error)
NewCloudflare creates a new Cloudflare API client for both the zone and DNS API. This returns instances to the given APIs and any errors. TODO: check api keys
func (*Cloudflare) DeleteRecord ¶
func (c *Cloudflare) DeleteRecord(zoneID string, id string) error
func (*Cloudflare) FilterRecords ¶
func (c *Cloudflare) FilterRecords(records []*Record, filters ...RecordFilter) []*Record
func (*Cloudflare) GetRecords ¶
func (c *Cloudflare) GetRecords(zoneID string, filters ...RecordFilter) ([]*Record, error)
func (*Cloudflare) GetZones ¶
func (c *Cloudflare) GetZones(filters ...ZoneFilter) (map[string]string, error)
GetZones returns a map of zone names to zone IDs. This is useful for interacting with the Cloudflare API since many requests (such as DNS requests) require a zone ID. Zones can be filtered too based on a given set of filters that are ran in the order provided.
func (*Cloudflare) Records ¶
func (c *Cloudflare) Records() map[string]*Record
func (*Cloudflare) SetAllowedZones ¶
func (c *Cloudflare) SetAllowedZones(names ...string)
func (*Cloudflare) UpdateRecordAddress ¶
func (c *Cloudflare) UpdateRecordAddress(zoneID string, id, address string) error
type RecordFilter ¶
func RecordFilterAddressIn ¶
func RecordFilterAddressIn(addresses ...netip.Addr) RecordFilter
func RecordFilterCommentContains ¶
func RecordFilterCommentContains(str string) RecordFilter
func RecordFilterNameIn ¶
func RecordFilterNameIn(names ...string) RecordFilter
func RecordFilterTypeIn ¶
func RecordFilterTypeIn(types ...string) RecordFilter
type ZoneFilter ¶
type ZoneFilter func(zone []cloudflare.Zone) []cloudflare.Zone
func ZoneFilterIDIn ¶
func ZoneFilterIDIn(ids ...string) ZoneFilter
ZoneFilterIDIn returns a zone filter that filters zones based on the given ids. If a zone has an id that is **not** in the given list, it will be filtered out of any returned set.
func ZoneFilterNameIn ¶
func ZoneFilterNameIn(names ...string) ZoneFilter
ZoneFilterNameIn returns a zone filter that filters zones based on the given names. If a zone has a name that is **not** in the given list, it will be filtered out of any returned set.