Documentation
¶
Index ¶
- Constants
- type APIError
- type BooleanType
- type Client
- func (c *Client) CreateDNSRecord(ctx context.Context, opts RecordOptions) (int, error)
- func (c *Client) CreateURLForward(ctx context.Context, opts URLForwardOptions) error
- func (c *Client) DeleteRecordByID(ctx context.Context, domain string, id int, keys *Keys) error
- func (c *Client) DeleteRecordsByNameAndType(ctx context.Context, opts RecordOptions) error
- func (c *Client) DeleteURLForward(ctx context.Context, domain string, forwardId string, keys *Keys) error
- func (c *Client) EditRecordByID(ctx context.Context, opts RecordOptions) error
- func (c *Client) EditRecordsByNameAndType(ctx context.Context, opts RecordOptions) error
- func (c *Client) GetAllDomains(ctx context.Context, keys *Keys) ([]Domain, error)
- func (c *Client) GetAllRecords(ctx context.Context, domain string, keys *Keys) ([]Record, error)
- func (c *Client) GetDomainPricing(ctx context.Context) (*DomainPricing, error)
- func (c *Client) GetNameServers(ctx context.Context, domain string, keys *Keys) ([]string, error)
- func (c *Client) GetRecordByID(ctx context.Context, domain string, id int, keys *Keys) (*Record, error)
- func (c *Client) GetRecordsByNameAndType(ctx context.Context, opts RecordOptions) ([]Record, error)
- func (c *Client) GetSSLBundle(ctx context.Context, opts SSLBundleOptions) (*SSLBundle, error)
- func (c *Client) GetUrlForwards(ctx context.Context, domain string, keys *Keys) ([]URLForward, error)
- func (c *Client) SetAPIKeys(keys *Keys)
- func (c *Client) UpdateNameServers(ctx context.Context, opts UpdateNameServerOptions) error
- func (c *Client) UseIPv4(value bool)
- type Domain
- type DomainPricing
- type ForwardType
- type Keys
- type Record
- type RecordOptions
- type RecordType
- type SSLBundle
- type SSLBundleOptions
- type URLForward
- type URLForwardOptions
- type UpdateNameServerOptions
Constants ¶
const ( // Hostname to force the use of IPv4 IPv4ApiHost = "api-ipv4.porkbun.com" // Porkbun API hostname APIHost = "porkbun.com" // Porkbun API base path BasePath = "/api/json" // Porkbun API version APIVersion = "v3" // connect to API with http(s) APIProto = "https" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BooleanType ¶
type BooleanType string
Type to represent yes or no
const ( Yes BooleanType = "yes" No BooleanType = "no" )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper around the Resty client
func NewClientWithAPIKeys ¶
NewClient factory to create a new client with the the specified API keys
func (*Client) CreateDNSRecord ¶
Create a DNS record
func (*Client) CreateURLForward ¶
func (c *Client) CreateURLForward(ctx context.Context, opts URLForwardOptions) error
Create a URL forward for the specified domain
func (*Client) DeleteRecordByID ¶
Delete a specific DNS record by it's ID
func (*Client) DeleteRecordsByNameAndType ¶
func (c *Client) DeleteRecordsByNameAndType(ctx context.Context, opts RecordOptions) error
Delete all records for the domain that match a particular subdomain/name and type. If name is not provided, it will delete records for the root with the specified type
func (*Client) DeleteURLForward ¶
func (c *Client) DeleteURLForward(ctx context.Context, domain string, forwardId string, keys *Keys) error
Delete the specified URL forwarding for a domain
func (*Client) EditRecordByID ¶
func (c *Client) EditRecordByID(ctx context.Context, opts RecordOptions) error
Edit a DNS record using the Second level domain and the ID of the dns record
func (*Client) EditRecordsByNameAndType ¶
func (c *Client) EditRecordsByNameAndType(ctx context.Context, opts RecordOptions) error
Edit all records for the domain that match a specific subdomain and type
func (*Client) GetAllDomains ¶
Get all domain names for the current account
func (*Client) GetAllRecords ¶
Retrieve all editable DNS records for a specified domain
func (*Client) GetDomainPricing ¶
func (c *Client) GetDomainPricing(ctx context.Context) (*DomainPricing, error)
Checks default domain pricing information for all supported TLDs.
func (*Client) GetNameServers ¶
Get Authoritative nameservers listed at the registry for the specified domain
func (*Client) GetRecordByID ¶
func (c *Client) GetRecordByID(ctx context.Context, domain string, id int, keys *Keys) (*Record, error)
Retrieve a specific DNS record by the given record ID
func (*Client) GetRecordsByNameAndType ¶
retrieve all records for the domain that match a particular subdomain/name and type. If name is not provided, it will retrieve records for the root with the specified type
func (*Client) GetSSLBundle ¶
func (*Client) GetUrlForwards ¶
func (c *Client) GetUrlForwards(ctx context.Context, domain string, keys *Keys) ([]URLForward, error)
Get URL forwarding for the specified domain
func (*Client) SetAPIKeys ¶
SetAPIKeys sets the API keys for to be used with all the requests from this client. The API keys can be overridden for individual requests using the requests options
func (*Client) UpdateNameServers ¶
func (c *Client) UpdateNameServers(ctx context.Context, opts UpdateNameServerOptions) error
Update the authoritative nameservers for the specified domain
type Domain ¶
type Domain struct { Domain string `json:"domain"` Status string `json:"status"` TLD string `json:"tld"` CreateDate string `json:"createDate"` ExpireDate string `json:"expireDate"` SecurityLock string `json:"securityLock"` WhoisPrivacy string `json:"whoisPrivacy"` AutoRenew int `json:"autoRenew,string"` NotLocal int `json:"notLocal"` }
Domain represents a second level domain owned by the account
type DomainPricing ¶
type DomainPricing struct { Status string `json:"status"` Pricing map[string]struct { Registration string `json:"registration"` Renewal string `json:"renewal"` Transfer string `json:"transfer"` } `json:"pricing"` }
Domain Pricing represents the response of the domain pricing API
type ForwardType ¶
type ForwardType string
Constants are the redirect types that can be assigned to a URL Forward
const ( Temporary ForwardType = "temporary" Permanent ForwardType = "permanent" )
type Record ¶
type Record struct { ID string `json:"id"` Name string `json:"name"` Type RecordType `json:"type"` Content string `json:"content"` TTL string `json:"ttl"` Priority string `json:"prio"` Notes string `json:"notes"` }
DNS record
type RecordOptions ¶
type RecordOptions struct { *Keys // ID of DNS record created ID string `json:"-"` // Second level domain Domain string `json:"-"` // The subdomain for the record being created or updated, not including the domain itself. // Leave blank to create/update record on root. Use * to create/update wildcard Name string `json:"name,omitempty"` // Type of record being created/updated Type RecordType `json:"type,omitempty"` // Answer content for the record. Content string `json:"content,omitempty"` // The time to live for the record. The minimum allowed and default // is 600 seconds TTL int `json:"ttl,omitempty"` // Priority of the record, for the record types that support it Priority int `json:"prio,omitempty"` }
RecordOptions fields are those accepted by various methods
type RecordType ¶
type RecordType string
const ( A RecordType = "A" MX RecordType = "MX" CNAME RecordType = "CNAME" ALIAS RecordType = "ALIAS" TXT RecordType = "TXT" NS RecordType = "NS" AAAA RecordType = "AAAA" SRV RecordType = "SRV" TLSA RecordType = "TLSA" CAA RecordType = "CAA" )
RecordType constants are the DNS record types that can be created
type SSLBundleOptions ¶
type URLForward ¶
type URLForward struct { // Subdomain id Id string `json:"id"` // Name of subdomain Subdomain string `json:"subdomain"` // URL forwarding destination Location string `json:"location"` // Type of forward temporary or permanent Type ForwardType `json:"type"` // Whether URI path is included in redirection IncludePath BooleanType `json:"includePath"` //Forward all subdomains of this domain/subdomain Wildcard BooleanType `json:"wildcard"` }
URL forward returned from porkbun API
type URLForwardOptions ¶
type URLForwardOptions struct { *Keys // [Optional] A subdomain that you would like to add email forwarding for. SubDomain string `json:"subdomain,omitempty"` // Destination for URL forwarding Location string `json:"location"` // Type of forward. // Valid types: [permament,temporary] Type ForwardType `json:"type"` // Include or don't include URI path in redirection. // Valid: [yes,no] IncludePath BooleanType `json:"includePath"` // Forward all subdomains of this domain // Valid: [yes,no] Wildcard BooleanType `json:"wildcard"` Domain string `json:"-"` }
Options for creating a URL Forward
type UpdateNameServerOptions ¶
type UpdateNameServerOptions struct { *Keys Nameservers []string `json:"ns"` Domain string `json:"-"` }
UpdateNSOptions fields