README ¶
Selectel DNS v2 for libdns
This package implements the libdns interfaces for Selectel DNS v2 API, allowing you to manage DNS records.
Authorize
To authorize you need to use Selectel Authorization.
Example
Minimal working example of getting DNS zone records.
package main
import (
"context"
"fmt"
"os"
"github.com/libdns/libdns/selectelv2"
)
func main() {
provider = selectelv2.Provider{
User: os.Getenv("SELECTEL_USER"),
Password: os.Getenv("SELECTEL_PASSWORD"),
AccountId: os.Getenv("SELECTEL_ACCOUNT_ID"),
ProjectName: os.Getenv("SELECTEL_PROJECT_NAME"),
ZonesCache: make(map[string]string),
}
zone = os.Getenv("SELECTEL_ZONE")
ctx = context.Background()
records, err := provider.GetRecords(ctx, zone)
if err != nil {
fmt.Printf("Error: %s", err)
return
}
fmt.Println(records)
}
See also: provider_test.go
Always yours @jjazzme
Documentation ¶
Overview ¶
Package selectelv2 implements a DNS record management client compatible with the libdns interfaces for selectel v2.
Index ¶
- type Provider
- func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- type RValue
- type Record
- type Recordset
- type Zone
- type Zones
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct { User string `json:"user,omitempty"` Password string `json:"password,omitempty"` AccountId string `json:"account_id,omitempty"` ProjectName string `json:"project_name,omitempty"` KeystoneToken string ZonesCache map[string]string // contains filtered or unexported fields }
Provider facilitates DNS record manipulation with <TODO: PROVIDER NAME>.
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
AppendRecords adds records to the zone. It returns the records that were added.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
DeleteRecords deletes the records from the zone. It returns the records that were deleted.
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone.