Documentation ¶
Index ¶
- func BearerAuth(token string) func() authHeader
- func ContentFromValue(recordType, content string) []any
- func PermanentAPIKeyAuth(token string) func() authHeader
- type APIError
- type AddZone
- type AddZoneOpt
- type Client
- func (c *Client) AddZoneRRSet(ctx context.Context, zone, recordName, recordType string, ...) error
- func (c *Client) AllZones(ctx context.Context, nameFilters []string) ([]Zone, error)
- func (c *Client) AllZonesWithRecords(ctx context.Context, nameFilters []string) ([]Zone, error)
- func (c *Client) CreateRRSet(ctx context.Context, zone, name, recordType string, record RRSet) error
- func (c *Client) CreateZone(ctx context.Context, name string) (uint64, error)
- func (c *Client) DNSSecDS(ctx context.Context, zone string) (DNSSecDS, error)
- func (c *Client) DeleteRRSet(ctx context.Context, zone, name, recordType string) error
- func (c *Client) DeleteRRSetRecord(ctx context.Context, zone, name, recordType string, contents ...string) error
- func (c *Client) DeleteZone(ctx context.Context, name string) error
- func (c *Client) RRSet(ctx context.Context, zone, name, recordType string) (RRSet, error)
- func (c *Client) ToggleDnssec(ctx context.Context, zone string, enable bool) (DNSSecDS, error)
- func (c *Client) UpdateRRSet(ctx context.Context, zone, name, recordType string, record RRSet) error
- func (c *Client) Zone(ctx context.Context, name string) (Zone, error)
- func (c *Client) ZoneNameservers(ctx context.Context, name string) ([]string, error)
- func (c *Client) Zones(ctx context.Context, filters ...func(zone *ZonesFilter)) ([]Zone, error)
- func (c *Client) ZonesWithParam(ctx context.Context, param ZonesParam) (res ListZones, err error)
- func (c *Client) ZonesWithRecords(ctx context.Context, filters ...func(zone *ZonesFilter)) ([]Zone, error)
- type CreateResponse
- type DNSSecDS
- type FailoverHttpCheck
- type FailoverIcmpCheck
- type FailoverTcpUdpCheck
- type ListZones
- type RRSet
- func (rr *RRSet) AddFilter(filters ...RecordFilter) *RRSet
- func (r *RRSet) SetMetaAsn(asns []int) *RRSet
- func (r *RRSet) SetMetaBackup(backup bool) *RRSet
- func (r *RRSet) SetMetaContinents(continents []string) *RRSet
- func (r *RRSet) SetMetaCountries(countries []string) *RRSet
- func (r *RRSet) SetMetaFailover(failover map[string]any) *RRSet
- func (r *RRSet) SetMetaFailoverHttp(check FailoverHttpCheck) *RRSet
- func (r *RRSet) SetMetaFailoverIcmp(check FailoverIcmpCheck) *RRSet
- func (r *RRSet) SetMetaFailoverTcpUdp(check FailoverTcpUdpCheck) *RRSet
- func (r *RRSet) SetMetaFallback(fallback bool) *RRSet
- func (r *RRSet) SetMetaGeodnsLink(link string) *RRSet
- func (r *RRSet) SetMetaIP(ip string) *RRSet
- func (r *RRSet) SetMetaLatLong(lat, long float64) *RRSet
- func (r *RRSet) SetMetaNotes(notes string) *RRSet
- func (r *RRSet) SetMetaWeight(weight float64) *RRSet
- type RRSetMeta
- func NewRRSetMetaFailoverFromMap(failover map[string]any) *RRSetMeta
- func NewRRSetMetaGeodnsLink(link string) *RRSetMeta
- func NewRRSetMetaMetaFailoverFromHttp(failover FailoverHttpCheck) *RRSetMeta
- func NewRRSetMetaMetaFailoverFromIcmp(failover FailoverIcmpCheck) *RRSetMeta
- func NewRRSetMetaMetaFailoverFromTcpUdp(failover FailoverTcpUdpCheck) *RRSetMeta
- type RRSets
- type RecordFilter
- type RecordType
- type RecordTypeAny
- type RecordTypeCAA
- type RecordTypeHTTPS_SCVB
- type RecordTypeMX
- type RecordTypeSRV
- type ResourceMeta
- func NewResourceMetaAsn(asn ...uint64) ResourceMeta
- func NewResourceMetaBackup() ResourceMeta
- func NewResourceMetaContinents(continents ...string) ResourceMeta
- func NewResourceMetaCountries(countries ...string) ResourceMeta
- func NewResourceMetaDefault() ResourceMeta
- func NewResourceMetaFallback() ResourceMeta
- func NewResourceMetaIP(ips ...string) ResourceMeta
- func NewResourceMetaLatLong(latlong string) ResourceMeta
- func NewResourceMetaNotes(notes ...string) ResourceMeta
- func NewResourceMetaWeight(weight int) ResourceMeta
- type ResourceRecord
- type Zone
- type ZoneRecord
- type ZonesFilter
- type ZonesParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentFromValue ¶
ContentFromValue convertor from flat value to valid for api
func PermanentAPIKeyAuth ¶
func PermanentAPIKeyAuth(token string) func() authHeader
PermanentAPIKeyAuth by header
Types ¶
type AddZoneOpt ¶
type AddZoneOpt func(*RRSet)
AddZoneOpt setup RRSet
func WithFilters ¶
func WithFilters(filters ...RecordFilter) AddZoneOpt
WithFilters add filters to RRSet
type Client ¶
type Client struct { HTTPClient *http.Client UserAgent string BaseURL *url.URL Debug bool // contains filtered or unexported fields }
Client for DNS API.
func (*Client) AddZoneRRSet ¶
func (c *Client) AddZoneRRSet(ctx context.Context, zone, recordName, recordType string, values []ResourceRecord, ttl int, opts ...AddZoneOpt) error
AddZoneRRSet create or extend resource record.
func (*Client) AllZonesWithRecords ¶ added in v0.2.8
AllZonesWithRecords gets all zones with records information.
func (*Client) CreateRRSet ¶
func (c *Client) CreateRRSet(ctx context.Context, zone, name, recordType string, record RRSet) error
CreateRRSet https://apidocs.gcore.com/dns#tag/rrsets/operation/CreateRRSet
func (*Client) CreateZone ¶
CreateZone adds new zone. https://apidocs.gcore.com/dns#tag/zones/operation/CreateZone
func (*Client) DNSSecDS ¶ added in v0.2.9
DNSSecDS https://api.gcore.com/docs/dns#tag/DNSSEC/operation/GetDNSSECDS
func (*Client) DeleteRRSet ¶
DeleteRRSet removes RRSet type records. https://apidocs.gcore.com/dns#tag/rrsets/operation/DeleteRRSet
func (*Client) DeleteRRSetRecord ¶
func (c *Client) DeleteRRSetRecord(ctx context.Context, zone, name, recordType string, contents ...string) error
DeleteRRSetRecord removes RRSet record.
func (*Client) DeleteZone ¶
DeleteZone gets zone information. https://apidocs.gcore.com/dns#tag/zones/operation/DeleteZone
func (*Client) RRSet ¶
RRSet gets RRSet item. https://apidocs.gcore.com/dns#tag/rrsets/operation/RRSet
func (*Client) ToggleDnssec ¶ added in v0.2.9
ToggleDnssec https://api.gcore.com/docs/dns#tag/DNSSEC/operation/ToggleDNSSEC
func (*Client) UpdateRRSet ¶
func (c *Client) UpdateRRSet(ctx context.Context, zone, name, recordType string, record RRSet) error
UpdateRRSet https://apidocs.gcore.com/dns#tag/rrsets/operation/UpdateRRSet
func (*Client) Zone ¶
Zone gets zone information. https://apidocs.gcore.com/dns#tag/zones/operation/Zone
func (*Client) ZoneNameservers ¶ added in v0.2.4
ZoneNameservers gets zone nameservers.
func (*Client) Zones ¶
Zones gets first 100 zones. https://apidocs.gcore.com/dns#tag/zones/operation/Zones
func (*Client) ZonesWithParam ¶ added in v0.2.7
ZonesWithParam gets zones with params.
func (*Client) ZonesWithRecords ¶
func (c *Client) ZonesWithRecords(ctx context.Context, filters ...func(zone *ZonesFilter)) ([]Zone, error)
ZonesWithRecords gets first 100 zones with records information.
type CreateResponse ¶
type CreateResponse struct { ID uint64 `json:"id,omitempty"` Error string `json:"error,omitempty"` }
CreateResponse dto to create new zone
type DNSSecDS ¶ added in v0.2.9
type DNSSecDS struct { Algorithm string `json:"algorithm"` Digest string `json:"digest"` DigestAlgorithm string `json:"digest_algorithm"` DigestType string `json:"digest_type"` Ds string `json:"ds"` Flags int `json:"flags"` KeyTag int `json:"key_tag"` KeyType string `json:"key_type"` PublicKey string `json:"public_key"` Uuid string `json:"uuid"` }
DNSSecDS dto describe DS records that returned from API on DNSSec requests
type FailoverHttpCheck ¶ added in v0.2.7
type FailoverHttpCheck struct { Protocol string `json:"protocol"` // HTTP Port uint16 `json:"port"` Frequency uint16 `json:"frequency"` Timeout uint16 `json:"timeout"` // HTTP only Method string `json:"method,omitempty"` // GET, POST, PUT, DELETE, PATCH URL string `json:"url,omitempty"` // without / prefix Host *string `json:"host,omitempty"` HttpStatusCode *uint16 `json:"http_status_code,omitempty"` // 100-599 Regexp *string `json:"regexp,omitempty"` TLS bool `json:"tls"` }
FailoverHttpCheck for failover meta property with protocol=HTTP
type FailoverIcmpCheck ¶ added in v0.2.7
type FailoverIcmpCheck struct { Protocol string `json:"protocol"` // ICMP Port uint16 `json:"port"` Frequency uint16 `json:"frequency"` Timeout uint16 `json:"timeout"` }
FailoverIcmpCheck for failover meta property with protocol=ICMP
type FailoverTcpUdpCheck ¶ added in v0.2.7
type FailoverTcpUdpCheck struct { Protocol string `json:"protocol"` // TCP or UDP Port uint16 `json:"port"` Frequency uint16 `json:"frequency"` Timeout uint16 `json:"timeout"` // TCP/UDP only Command *string `json:"command"` // bytes to sent Regexp *string `json:"regexp,omitempty"` }
FailoverTcpUdpCheck for failover meta property with protocol=TCP|UDP
type ListZones ¶
type ListZones struct { Zones []Zone `json:"zones"` TotalAmount int `json:"total_amount"` Error string `json:"error,omitempty"` }
ListZones dto to read list of zones from API
type RRSet ¶
type RRSet struct { Type string `json:"type"` TTL int `json:"ttl"` Records []ResourceRecord `json:"resource_records"` Filters []RecordFilter `json:"filters"` Meta RRSetMeta `json:"meta"` // this one for failover, not Meta property inside Records }
RRSet dto as part of zone info from API
func (*RRSet) AddFilter ¶
func (rr *RRSet) AddFilter(filters ...RecordFilter) *RRSet
AddFilter to RRSet
func (*RRSet) SetMetaBackup ¶ added in v0.2.7
SetMetaBackup
func (*RRSet) SetMetaContinents ¶ added in v0.2.7
SetMetaContinents
func (*RRSet) SetMetaCountries ¶ added in v0.2.7
SetMetaCountries
func (*RRSet) SetMetaFailover ¶ added in v0.2.7
SetMetaFailover
func (*RRSet) SetMetaFailoverHttp ¶ added in v0.2.7
func (r *RRSet) SetMetaFailoverHttp(check FailoverHttpCheck) *RRSet
SetMetaFailoverHttp for failover
func (*RRSet) SetMetaFailoverIcmp ¶ added in v0.2.7
func (r *RRSet) SetMetaFailoverIcmp(check FailoverIcmpCheck) *RRSet
SetMetaFailoverIcmp for ICMP failover
func (*RRSet) SetMetaFailoverTcpUdp ¶ added in v0.2.7
func (r *RRSet) SetMetaFailoverTcpUdp(check FailoverTcpUdpCheck) *RRSet
SetMetaFailoverTcpUdp for TCP/DUP failover
func (*RRSet) SetMetaFallback ¶ added in v0.2.7
SetMetaFallback
func (*RRSet) SetMetaGeodnsLink ¶ added in v0.2.7
SetMetaGeodnsLink
func (*RRSet) SetMetaLatLong ¶ added in v0.2.7
SetMetaLatLong
func (*RRSet) SetMetaNotes ¶ added in v0.2.7
SetMetaNotes
func (*RRSet) SetMetaWeight ¶ added in v0.2.7
SetMetaWeight
type RRSetMeta ¶ added in v0.2.7
func NewRRSetMetaFailoverFromMap ¶ added in v0.2.7
NewRRSetMetaFailoverFromMap for failover
func NewRRSetMetaGeodnsLink ¶ added in v0.2.7
func NewRRSetMetaMetaFailoverFromHttp ¶ added in v0.2.7
func NewRRSetMetaMetaFailoverFromHttp(failover FailoverHttpCheck) *RRSetMeta
NewRRSetMetaMetaFailoverFromHttp for failover
func NewRRSetMetaMetaFailoverFromIcmp ¶ added in v0.2.7
func NewRRSetMetaMetaFailoverFromIcmp(failover FailoverIcmpCheck) *RRSetMeta
NewRRSetMetaMetaFailoverFromIcmp for ICMP failover
func NewRRSetMetaMetaFailoverFromTcpUdp ¶ added in v0.2.7
func NewRRSetMetaMetaFailoverFromTcpUdp(failover FailoverTcpUdpCheck) *RRSetMeta
NewRRSetMetaMetaFailoverFromTcpUdp for TCP/DUP failover
type RecordFilter ¶
type RecordFilter struct { Limit uint `json:"limit"` Type string `json:"type"` Strict bool `json:"strict"` }
RecordFilter describe Filters in RRSet
func NewDefaultFilter ¶
func NewDefaultFilter(limit uint, strict bool) RecordFilter
NewDefaultFilter for RRSet
func NewFirstNFilter ¶
func NewFirstNFilter(limit uint, strict bool) RecordFilter
NewFirstNFilter for RRSet
func NewGeoDNSFilter ¶
func NewGeoDNSFilter(limit uint, strict bool) RecordFilter
NewGeoDNSFilter for RRSet
func NewGeoDistanceFilter ¶
func NewGeoDistanceFilter(limit uint, strict bool) RecordFilter
NewGeoDistanceFilter for RRSet
type RecordTypeHTTPS_SCVB ¶ added in v0.2.5
type RecordTypeHTTPS_SCVB string
RecordTypeHTTPS_SCVB as type of record
func (RecordTypeHTTPS_SCVB) ToContent ¶ added in v0.2.5
func (r RecordTypeHTTPS_SCVB) ToContent() (res []any)
ToContent convertor
type ResourceMeta ¶
type ResourceMeta struct {
// contains filtered or unexported fields
}
ResourceMeta for ResourceRecord
func NewResourceMetaAsn ¶
func NewResourceMetaAsn(asn ...uint64) ResourceMeta
NewResourceMetaAsn for asn meta
func NewResourceMetaBackup ¶ added in v0.2.7
func NewResourceMetaBackup() ResourceMeta
NewResourceMetaBackup for backup meta
func NewResourceMetaContinents ¶
func NewResourceMetaContinents(continents ...string) ResourceMeta
NewResourceMetaContinents for continents meta
func NewResourceMetaCountries ¶
func NewResourceMetaCountries(countries ...string) ResourceMeta
NewResourceMetaCountries for Countries meta
func NewResourceMetaDefault ¶
func NewResourceMetaDefault() ResourceMeta
NewResourceMetaDefault for default meta
func NewResourceMetaFallback ¶ added in v0.2.7
func NewResourceMetaFallback() ResourceMeta
NewResourceMetaFallback for fallback meta
func NewResourceMetaIP ¶
func NewResourceMetaIP(ips ...string) ResourceMeta
NewResourceMetaIP for ip meta
func NewResourceMetaLatLong ¶
func NewResourceMetaLatLong(latlong string) ResourceMeta
NewResourceMetaLatLong for lat long meta
func NewResourceMetaNotes ¶
func NewResourceMetaNotes(notes ...string) ResourceMeta
NewResourceMetaNotes for notes meta
func NewResourceMetaWeight ¶ added in v0.2.7
func NewResourceMetaWeight(weight int) ResourceMeta
NewResourceMetaWeight for fallback meta
type ResourceRecord ¶
type ResourceRecord struct { Content []any `json:"content"` Meta map[string]any `json:"meta"` Enabled bool `json:"enabled"` }
ResourceRecord dto describe records in RRSet
func (*ResourceRecord) AddMeta ¶
func (r *ResourceRecord) AddMeta(meta ResourceMeta) *ResourceRecord
AddMeta to ResourceRecord
func (ResourceRecord) ContentToString ¶
func (r ResourceRecord) ContentToString() string
ContentToString as short value example from: tls-ech.dev. 899 IN HTTPS 1 . ech=AEn+DQBFKwAgACABWIHUGj4u+PIggYXcR5JF0gYk3dCRioBW8uJq9H4mKAAIAAEAAQABAANAEnB1YmxpYy50bHMtZWNoLmRldgAA clickhouse.com. 899 IN HTTPS 1 . alpn="h3,h3-29,h2" ipv4hint=172.66.40.249,172.66.43.7 ipv6hint=2606:4700:3108::ac42:28f9,2606:4700:3108::ac42:2b07
func (*ResourceRecord) SetContent ¶
func (r *ResourceRecord) SetContent(recordType, val string) *ResourceRecord
SetContent to ResourceRecord
type Zone ¶
type Zone struct { Name string `json:"name"` Records []ZoneRecord `json:"records"` }
Zone dto to read info from API
type ZoneRecord ¶
type ZoneRecord struct { Name string `json:"name"` Type string `json:"type"` TTL uint `json:"ttl"` ShortAnswers []string `json:"short_answers"` }
ZoneRecord dto describe records in Zone
type ZonesParam ¶ added in v0.2.7
type ZonesParam struct { Offset uint64 Limit uint64 OrderBy string OrderDirection string ID []uint64 ClientID []uint64 ResellerID []uint64 IAMResellerID []uint64 Name []string CaseSensitive bool ExactMatch bool Enabled bool Status string Dynamic bool Healthcheck bool UpdatedAtFrom time.Time UpdatedAtTo time.Time }
ZonesParam parameter for ZonesWithParam method
offset integer <uint64> Amount of records to skip before beginning to write in response.
limit integer <uint64> Max number of records in response
order_by string Field name to sort by
order_direction string Enum: "asc" "desc"
Ascending or descending order id Array of integers <int64> [ items <int64 > ]
to pass several ids id=1&id=3&id=5... client_id Array of integers <int64> [ items <int64 > ]
to pass several client_ids client_id=1&client_id=3&client_id=5... reseller_id Array of integers <int64> [ items <int64 > ]
iam_reseller_id Array of integers <int64> [ items <int64 > ]
name Array of strings to pass several names name=first&name=second...
case_sensitive boolean
exact_match boolean
enabled boolean
status string
dynamic boolean Zones with dynamic RRsets
healthcheck boolean Zones with RRsets that have healthchecks
updated_at_from string <date-time>
updated_at_to string <date-time>