Documentation ¶
Index ¶
- Constants
- type APIError
- type BadRequest
- type Client
- type Domain
- type DomainService
- type NotFound
- type PaginationParameters
- type Record
- type RecordRequest
- type RecordValue
- type SuccessMessage
- type TokenTransport
- type TxtRecordService
- func (s *TxtRecordService) Create(ctx context.Context, domainID int64, record RecordRequest) ([]Record, error)
- func (s *TxtRecordService) Delete(ctx context.Context, domainID, recordID int64) (*SuccessMessage, error)
- func (s *TxtRecordService) Get(ctx context.Context, domainID, recordID int64) (*Record, error)
- func (s *TxtRecordService) GetAll(ctx context.Context, domainID int64) ([]Record, error)
- func (s *TxtRecordService) Search(ctx context.Context, domainID int64, filter searchFilter, value string) ([]Record, error)
- func (s *TxtRecordService) Update(ctx context.Context, domainID, recordID int64, record RecordRequest) (*SuccessMessage, error)
Constants ¶
const ( StartsWith searchFilter = "startswith" Exact searchFilter = "exact" EndsWith searchFilter = "endswith" Contains searchFilter = "contains" )
Search filters.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadRequest ¶
type BadRequest struct {
*APIError
}
BadRequest Bad request error.
func (*BadRequest) Unwrap ¶
func (e *BadRequest) Unwrap() error
type Client ¶
type Client struct { BaseURL string HTTPClient *http.Client // Services used for communicating with the API Domains *DomainService TxtRecords *TxtRecordService // contains filtered or unexported fields }
Client the Constellix client.
type Domain ¶
type Domain struct { ID int64 `json:"id"` Name string `json:"name,omitempty"` TypeID int64 `json:"typeId,omitempty"` Version int64 `json:"version,omitempty"` Status string `json:"status,omitempty"` }
Domain is the representation of a domain.
type DomainService ¶
type DomainService service
DomainService API access to Domain.
func (*DomainService) GetAll ¶
func (s *DomainService) GetAll(ctx context.Context, params *PaginationParameters) ([]Domain, error)
GetAll domains. https://api-docs.constellix.com/?version=latest#484c3f21-d724-4ee4-a6fa-ab22c8eb9e9b
func (*DomainService) Search ¶
func (s *DomainService) Search(ctx context.Context, filter searchFilter, value string) ([]Domain, error)
Search searches for a domain by name. https://api-docs.constellix.com/?version=latest#3d7b2679-2209-49f3-b011-b7d24e512008
type PaginationParameters ¶
type PaginationParameters struct { // Offset retrieves a subset of records starting with the offset value. Offset int `url:"offset"` // Max retrieves maximum number of dataset. Max int `url:"max"` // Sort on the basis of given property name. Sort string `url:"sort"` // Order Sort order. Possible values are asc / desc. Order string `url:"order"` }
PaginationParameters is pagination parameters.
type Record ¶
type Record struct { ID int64 `json:"id"` Type string `json:"type"` RecordType string `json:"recordType"` Name string `json:"name"` RecordOption string `json:"recordOption,omitempty"` NoAnswer bool `json:"noAnswer,omitempty"` Note string `json:"note,omitempty"` TTL int `json:"ttl,omitempty"` GtdRegion int `json:"gtdRegion,omitempty"` ParentID int `json:"parentId,omitempty"` Parent string `json:"parent,omitempty"` Source string `json:"source,omitempty"` ModifiedTS int64 `json:"modifiedTs,omitempty"` Value []RecordValue `json:"value,omitempty"` RoundRobin []RecordValue `json:"roundRobin,omitempty"` }
Record is the representation of a record.
type RecordRequest ¶
type RecordRequest struct { Name string `json:"name"` TTL int `json:"ttl,omitempty"` RoundRobin []RecordValue `json:"roundRobin,omitempty"` }
RecordRequest is the representation of a request's record.
type RecordValue ¶
type RecordValue struct { Value string `json:"value,omitempty"` DisableFlag bool `json:"disableFlag,omitempty"` // only for the response }
RecordValue is the representation of a record's value.
type SuccessMessage ¶
type SuccessMessage struct {
Success string `json:"success"`
}
SuccessMessage is the representation of a success message.
type TokenTransport ¶
type TokenTransport struct { // Transport is the underlying HTTP transport to use when making requests. // It will default to http.DefaultTransport if nil. Transport http.RoundTripper // contains filtered or unexported fields }
TokenTransport HTTP transport for API authentication.
func NewTokenTransport ¶
func NewTokenTransport(apiKey, secretKey string) (*TokenTransport, error)
NewTokenTransport Creates an HTTP transport for API authentication.
func (*TokenTransport) Client ¶
func (t *TokenTransport) Client() *http.Client
Client Creates a new HTTP client.
type TxtRecordService ¶
type TxtRecordService service
TxtRecordService API access to Record.
func (*TxtRecordService) Create ¶
func (s *TxtRecordService) Create(ctx context.Context, domainID int64, record RecordRequest) ([]Record, error)
Create a TXT record. https://api-docs.constellix.com/?version=latest#22e24d5b-9ec0-49a7-b2b0-5ff0a28e71be
func (*TxtRecordService) Delete ¶
func (s *TxtRecordService) Delete(ctx context.Context, domainID, recordID int64) (*SuccessMessage, error)
Delete a TXT record. https://api-docs.constellix.com/?version=latest#135947f7-d6c8-481a-83c7-4d387b0bdf9e
func (*TxtRecordService) Get ¶
Get a TXT record. https://api-docs.constellix.com/?version=latest#e7103c53-2ad8-4bc8-b5b3-4c22c4b571b2
func (*TxtRecordService) GetAll ¶
GetAll TXT records. https://api-docs.constellix.com/?version=latest#e7103c53-2ad8-4bc8-b5b3-4c22c4b571b2
func (*TxtRecordService) Search ¶
func (s *TxtRecordService) Search(ctx context.Context, domainID int64, filter searchFilter, value string) ([]Record, error)
Search searches for a TXT record by name. https://api-docs.constellix.com/?version=latest#81003e4f-bd3f-413f-a18d-6d9d18f10201
func (*TxtRecordService) Update ¶
func (s *TxtRecordService) Update(ctx context.Context, domainID, recordID int64, record RecordRequest) (*SuccessMessage, error)
Update a TXT record. https://api-docs.constellix.com/?version=latest#d4e9ab2e-fac0-45a6-b0e4-cf62a2d2e3da