Documentation
¶
Overview ¶
Package libdnsspaceship implements a DNS record management client compatible with the libdns interfaces for Spaceship. This package allows you to manage DNS records using the Spaceship DNS API.
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) PopulateFromEnv()
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- type ResourceRecordBase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// APIKey is the Spaceship API key for authentication
APIKey string `json:"api_key,omitempty"`
// APISecret is the Spaceship API secret for authentication
APISecret string `json:"api_secret,omitempty"`
// BaseURL is the base URL for the Spaceship API (defaults to https://spaceship.dev/api)
BaseURL string `json:"base_url,omitempty"`
// HTTPClient allows customization of the HTTP client used for API requests
HTTPClient *http.Client `json:"-"`
// PageSize controls pagination size used by GetRecords (defaults to 100)
PageSize int `json:"page_size,omitempty"`
}
Provider facilitates DNS record manipulation with Spaceship.
func NewProviderFromEnv ¶
func NewProviderFromEnv() *Provider
NewProviderFromEnv constructs a Provider using environment variables. Recognized environment variables: - LIBDNS_SPACESHIP_APIKEY: API key (required for API calls) - LIBDNS_SPACESHIP_APISECRET: API secret (required for API calls) - LIBDNS_SPACESHIP_BASEURL: optional base URL override - LIBDNS_SPACESHIP_PAGESIZE: optional page size for list operations - LIBDNS_SPACESHIP_TIMEOUT: optional HTTP client timeout in seconds
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 specified records from the zone. It returns the records that were deleted.
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone.
func (*Provider) PopulateFromEnv ¶
func (p *Provider) PopulateFromEnv()
PopulateFromEnv fills unset Provider fields from environment variables.
type ResourceRecordBase ¶
type ResourceRecordBase struct {
Type string `json:"type"`
Name string `json:"name"`
TTL int `json:"ttl,omitempty"`
}
ResourceRecordBase contains fields common to all Spaceship DNS record payloads (this is intentionally minimal; each specific record type augments this with fields appropriate for that type).