Documentation
¶
Index ¶
- Constants
- func Pointer[T string](v T) *T
- type APIError
- type Account
- type AccountService
- func (s *AccountService) ChangeEmail(ctx context.Context, email, password, newEmail string) error
- func (s *AccountService) Delete(ctx context.Context, email, password string) error
- func (s *AccountService) Login(ctx context.Context, email, password string) (*Token, error)
- func (s *AccountService) Logout(ctx context.Context) error
- func (s *AccountService) ObtainCaptcha(ctx context.Context) (*Captcha, error)
- func (s *AccountService) PasswordReset(ctx context.Context, email string, captcha Captcha) error
- func (s *AccountService) Register(ctx context.Context, registration Registration) error
- func (s *AccountService) RetrieveInformation(ctx context.Context) (*Account, error)
- type Captcha
- type Client
- type ClientOptions
- type Cursors
- type Domain
- type DomainKey
- type DomainsService
- func (s *DomainsService) Create(ctx context.Context, domainName string) (*Domain, error)
- func (s *DomainsService) Delete(ctx context.Context, domainName string) error
- func (s *DomainsService) Get(ctx context.Context, domainName string) (*Domain, error)
- func (s *DomainsService) GetAll(ctx context.Context) ([]Domain, error)
- func (s *DomainsService) GetAllPaginated(ctx context.Context, cursor string) ([]Domain, *Cursors, error)
- func (s *DomainsService) GetResponsible(ctx context.Context, domainName string) (*Domain, error)
- type NotFoundError
- type RRSet
- type RRSetFilter
- type RecordsService
- func (s *RecordsService) BulkCreate(ctx context.Context, domainName string, rrSets []RRSet) ([]RRSet, error)
- func (s *RecordsService) BulkDelete(ctx context.Context, domainName string, rrSets []RRSet) error
- func (s *RecordsService) BulkUpdate(ctx context.Context, mode UpdateMode, domainName string, rrSets []RRSet) ([]RRSet, error)
- func (s *RecordsService) Create(ctx context.Context, rrSet RRSet) (*RRSet, error)
- func (s *RecordsService) Delete(ctx context.Context, domainName, subName, recordType string) error
- func (s *RecordsService) Get(ctx context.Context, domainName, subName, recordType string) (*RRSet, error)
- func (s *RecordsService) GetAll(ctx context.Context, domainName string, filter *RRSetFilter) ([]RRSet, error)
- func (s *RecordsService) GetAllPaginated(ctx context.Context, domainName string, filter *RRSetFilter, cursor string) ([]RRSet, *Cursors, error)
- func (s *RecordsService) Replace(ctx context.Context, domainName, subName, recordType string, rrSet RRSet) (*RRSet, error)
- func (s *RecordsService) Update(ctx context.Context, domainName, subName, recordType string, rrSet RRSet) (*RRSet, error)
- type Registration
- type Token
- type TokenPoliciesService
- func (s *TokenPoliciesService) Create(ctx context.Context, tokenID string, policy TokenPolicy) (*TokenPolicy, error)
- func (s *TokenPoliciesService) Delete(ctx context.Context, tokenID, policyID string) error
- func (s *TokenPoliciesService) Get(ctx context.Context, tokenID string) ([]TokenPolicy, error)
- type TokenPolicy
- type TokensService
- type UpdateMode
Constants ¶
const ApexZone = "@"
ApexZone apex zone name. https://desec.readthedocs.io/en/latest/dns/rrsets.html#accessing-the-zone-apex
const IgnoreFilter = "#IGNORE#"
IgnoreFilter is a specific value used to ignore a filter field.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIError ¶ added in v0.2.0
type APIError struct { StatusCode int // contains filtered or unexported fields }
APIError error from API.
type Account ¶
type Account struct { Email string `json:"email"` Password string `json:"password"` LimitDomains int `json:"limit_domains,omitempty"` Created *time.Time `json:"created,omitempty"` }
Account an account representation.
type AccountService ¶ added in v0.2.0
type AccountService struct {
// contains filtered or unexported fields
}
AccountService handles communication with the account related methods of the deSEC API.
https://desec.readthedocs.io/en/latest/auth/account.html
func (*AccountService) ChangeEmail ¶ added in v0.2.0
func (s *AccountService) ChangeEmail(ctx context.Context, email, password, newEmail string) error
ChangeEmail changes email address. https://desec.readthedocs.io/en/latest/auth/account.html#change-email-address
func (*AccountService) Delete ¶ added in v0.2.0
func (s *AccountService) Delete(ctx context.Context, email, password string) error
Delete deletes account. https://desec.readthedocs.io/en/latest/auth/account.html#delete-account
func (*AccountService) Login ¶ added in v0.2.0
Login Log in. https://desec.readthedocs.io/en/latest/auth/account.html#log-in
func (*AccountService) Logout ¶ added in v0.2.0
func (s *AccountService) Logout(ctx context.Context) error
Logout log out (= delete current token). https://desec.readthedocs.io/en/latest/auth/account.html#log-out
func (*AccountService) ObtainCaptcha ¶ added in v0.2.0
func (s *AccountService) ObtainCaptcha(ctx context.Context) (*Captcha, error)
ObtainCaptcha Obtain a captcha. https://desec.readthedocs.io/en/latest/auth/account.html#obtain-a-captcha
func (*AccountService) PasswordReset ¶ added in v0.2.0
PasswordReset password reset and password change. https://desec.readthedocs.io/en/latest/auth/account.html#password-reset https://desec.readthedocs.io/en/latest/auth/account.html#password-change
func (*AccountService) Register ¶ added in v0.2.0
func (s *AccountService) Register(ctx context.Context, registration Registration) error
Register register account. https://desec.readthedocs.io/en/latest/auth/account.html#register-account
func (*AccountService) RetrieveInformation ¶ added in v0.2.0
func (s *AccountService) RetrieveInformation(ctx context.Context) (*Account, error)
RetrieveInformation retrieve account information. https://desec.readthedocs.io/en/latest/auth/account.html#retrieve-account-information
type Captcha ¶
type Captcha struct { ID string `json:"id,omitempty"` Challenge string `json:"challenge,omitempty"` Solution string `json:"solution,omitempty"` }
Captcha a captcha representation.
type Client ¶
type Client struct { // Base URL for API requests. BaseURL string // Services used for talking to different parts of the deSEC API. Account *AccountService Tokens *TokensService TokenPolicies *TokenPoliciesService Records *RecordsService Domains *DomainsService // contains filtered or unexported fields }
Client deSEC API client.
func New ¶ added in v0.4.0
func New(token string, opts ClientOptions) *Client
New creates a new Client.
type ClientOptions ¶ added in v0.4.0
type ClientOptions struct { // HTTPClient HTTP client used to communicate with the API. HTTPClient *http.Client // Maximum number of retries RetryMax int // Customer logger instance. Can be either Logger or LeveledLogger Logger interface{} }
ClientOptions the options of the Client.
func NewDefaultClientOptions ¶ added in v0.4.0
func NewDefaultClientOptions() ClientOptions
NewDefaultClientOptions creates a new ClientOptions with default values.
type Cursors ¶ added in v0.10.0
Cursors allows to retrieve the next (or previous) page. https://desec.readthedocs.io/en/latest/dns/rrsets.html#pagination
type Domain ¶
type Domain struct { Name string `json:"name,omitempty"` MinimumTTL int `json:"minimum_ttl,omitempty"` Keys []DomainKey `json:"keys,omitempty"` Created *time.Time `json:"created,omitempty"` Published *time.Time `json:"published,omitempty"` Touched *time.Time `json:"touched,omitempty"` }
Domain a domain representation.
type DomainKey ¶
type DomainKey struct { DNSKey string `json:"dnskey,omitempty"` DS []string `json:"ds,omitempty"` Flags int `json:"flags,omitempty"` KeyType string `json:"keytype,omitempty"` }
DomainKey a domain key representation.
type DomainsService ¶
type DomainsService struct {
// contains filtered or unexported fields
}
DomainsService handles communication with the domain related methods of the deSEC API.
https://desec.readthedocs.io/en/latest/dns/domains.html
func (*DomainsService) Create ¶
Create creating a domain. https://desec.readthedocs.io/en/latest/dns/domains.html#creating-a-domain
func (*DomainsService) Delete ¶
func (s *DomainsService) Delete(ctx context.Context, domainName string) error
Delete deleting a domain. https://desec.readthedocs.io/en/latest/dns/domains.html#deleting-a-domain
func (*DomainsService) Get ¶
Get retrieving a specific domain. https://desec.readthedocs.io/en/latest/dns/domains.html#retrieving-a-specific-domain
func (*DomainsService) GetAll ¶
func (s *DomainsService) GetAll(ctx context.Context) ([]Domain, error)
GetAll listing domains. https://desec.readthedocs.io/en/latest/dns/domains.html#listing-domains
func (*DomainsService) GetAllPaginated ¶ added in v0.10.0
func (s *DomainsService) GetAllPaginated(ctx context.Context, cursor string) ([]Domain, *Cursors, error)
GetAllPaginated listing domains. https://desec.readthedocs.io/en/latest/dns/domains.html#listing-domains
func (*DomainsService) GetResponsible ¶ added in v0.7.0
GetResponsible returns the responsible domain for a given DNS query name. https://desec.readthedocs.io/en/latest/dns/domains.html#identifying-the-responsible-domain-for-a-dns-name
type NotFoundError ¶ added in v0.6.0
type NotFoundError struct {
Detail string `json:"detail"`
}
NotFoundError Not found error.
func (NotFoundError) Error ¶ added in v0.6.0
func (n NotFoundError) Error() string
type RRSet ¶
type RRSet struct { Name string `json:"name,omitempty"` Domain string `json:"domain,omitempty"` SubName string `json:"subname,omitempty"` Type string `json:"type,omitempty"` Records []string `json:"records"` TTL int `json:"ttl,omitempty"` Created *time.Time `json:"created,omitempty"` Touched *time.Time `json:"touched,omitempty"` }
RRSet DNS Record Set.
type RRSetFilter ¶
RRSetFilter a RRSets filter.
func FilterRRSetOnlyOnSubName ¶ added in v0.9.0
func FilterRRSetOnlyOnSubName(n string) RRSetFilter
FilterRRSetOnlyOnSubName creates an RRSetFilter that ignore Type.
func FilterRRSetOnlyOnType ¶ added in v0.9.0
func FilterRRSetOnlyOnType(t string) RRSetFilter
FilterRRSetOnlyOnType creates an RRSetFilter that ignore SubName.
type RecordsService ¶
type RecordsService struct {
// contains filtered or unexported fields
}
RecordsService handles communication with the records related methods of the deSEC API.
https://desec.readthedocs.io/en/latest/dns/rrsets.html
func (*RecordsService) BulkCreate ¶ added in v0.9.0
func (s *RecordsService) BulkCreate(ctx context.Context, domainName string, rrSets []RRSet) ([]RRSet, error)
BulkCreate creates new RRSets in bulk. https://desec.readthedocs.io/en/latest/dns/rrsets.html#bulk-creation-of-rrsets
func (*RecordsService) BulkDelete ¶ added in v0.9.0
BulkDelete deletes RRSets in bulk (uses FullResourceUpdateMode). https://desec.readthedocs.io/en/latest/dns/rrsets.html#bulk-deletion-of-rrsets
func (*RecordsService) BulkUpdate ¶ added in v0.9.0
func (s *RecordsService) BulkUpdate(ctx context.Context, mode UpdateMode, domainName string, rrSets []RRSet) ([]RRSet, error)
BulkUpdate updates RRSets in bulk. https://desec.readthedocs.io/en/latest/dns/rrsets.html#bulk-modification-of-rrsets
func (*RecordsService) Create ¶
Create creates a new RRSet. https://desec.readthedocs.io/en/latest/dns/rrsets.html#creating-a-tlsa-rrset
func (*RecordsService) Delete ¶
func (s *RecordsService) Delete(ctx context.Context, domainName, subName, recordType string) error
Delete deletes a RRSet. https://desec.readthedocs.io/en/latest/dns/rrsets.html#deleting-an-rrset
func (*RecordsService) Get ¶
func (s *RecordsService) Get(ctx context.Context, domainName, subName, recordType string) (*RRSet, error)
Get gets a RRSet. https://desec.readthedocs.io/en/latest/dns/rrsets.html#retrieving-a-specific-rrset
func (*RecordsService) GetAll ¶
func (s *RecordsService) GetAll(ctx context.Context, domainName string, filter *RRSetFilter) ([]RRSet, error)
GetAll retrieving all RRSets in a zone. https://desec.readthedocs.io/en/latest/dns/rrsets.html#retrieving-all-rrsets-in-a-zone
func (*RecordsService) GetAllPaginated ¶ added in v0.10.0
func (s *RecordsService) GetAllPaginated(ctx context.Context, domainName string, filter *RRSetFilter, cursor string) ([]RRSet, *Cursors, error)
GetAllPaginated retrieving all RRSets in a zone. https://desec.readthedocs.io/en/latest/dns/rrsets.html#retrieving-all-rrsets-in-a-zone
func (*RecordsService) Replace ¶ added in v0.3.0
func (s *RecordsService) Replace(ctx context.Context, domainName, subName, recordType string, rrSet RRSet) (*RRSet, error)
Replace replaces a RRSet (PUT). https://desec.readthedocs.io/en/latest/dns/rrsets.html#modifying-an-rrset
func (*RecordsService) Update ¶
func (s *RecordsService) Update(ctx context.Context, domainName, subName, recordType string, rrSet RRSet) (*RRSet, error)
Update updates RRSet (PATCH). https://desec.readthedocs.io/en/latest/dns/rrsets.html#modifying-an-rrset
type Registration ¶
type Registration struct { Email string `json:"email,omitempty"` Password string `json:"password,omitempty"` NewEmail string `json:"new_email,omitempty"` Captcha *Captcha `json:"captcha,omitempty"` }
Registration a registration representation.
type Token ¶
type Token struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Value string `json:"token,omitempty"` Created *time.Time `json:"created,omitempty"` }
Token a token representation.
type TokenPoliciesService ¶ added in v0.8.0
type TokenPoliciesService struct {
// contains filtered or unexported fields
}
TokenPoliciesService handles communication with the token policy related methods of the deSEC API.
https://desec.readthedocs.io/en/latest/auth/tokens.html
func (*TokenPoliciesService) Create ¶ added in v0.8.0
func (s *TokenPoliciesService) Create(ctx context.Context, tokenID string, policy TokenPolicy) (*TokenPolicy, error)
Create creates token policy. https://desec.readthedocs.io/en/latest/auth/tokens.html#create-additional-tokens
func (*TokenPoliciesService) Delete ¶ added in v0.8.0
func (s *TokenPoliciesService) Delete(ctx context.Context, tokenID, policyID string) error
Delete deletes a token rrset's policy. https://desec.readthedocs.io/en/latest/auth/tokens.html#token-policy-management
func (*TokenPoliciesService) Get ¶ added in v0.8.0
func (s *TokenPoliciesService) Get(ctx context.Context, tokenID string) ([]TokenPolicy, error)
Get retrieves token rrset's policies. https://desec.readthedocs.io/en/latest/auth/tokens.html#token-policy-management
type TokenPolicy ¶ added in v0.8.0
type TokenPolicy struct { ID string `json:"id,omitempty"` Domain *string `json:"domain"` SubName *string `json:"subname"` Type *string `json:"type"` WritePermission bool `json:"perm_write,omitempty"` }
TokenPolicy represents a policy applied to a token.
type TokensService ¶
type TokensService struct {
// contains filtered or unexported fields
}
TokensService handles communication with the tokens related methods of the deSEC API.
https://desec.readthedocs.io/en/latest/auth/tokens.html
func (*TokensService) Create ¶
Create creates additional tokens. https://desec.readthedocs.io/en/latest/auth/tokens.html#create-additional-tokens
func (*TokensService) Delete ¶
func (s *TokensService) Delete(ctx context.Context, tokenID string) error
Delete deletes tokens. https://desec.readthedocs.io/en/latest/auth/tokens.html#delete-tokens
func (*TokensService) GetAll ¶
func (s *TokensService) GetAll(ctx context.Context) ([]Token, error)
GetAll retrieving all current tokens. https://desec.readthedocs.io/en/latest/auth/tokens.html#retrieving-all-current-tokens
type UpdateMode ¶ added in v0.9.0
type UpdateMode string
UpdateMode the mode used to bulk update operations.
const ( // FullResource the full resource must be specified. FullResource UpdateMode = http.MethodPut // OnlyFields only fields you would like to modify need to be provided. OnlyFields UpdateMode = http.MethodPatch )