internal

package
v4.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
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 APIError

type APIError struct {
	StatusCode int      `json:"statusCode"`
	Errors     []string `json:"errors"`
}

APIError is the representation of an API error.

func (APIError) Error

func (a APIError) Error() string

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.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient Creates a 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) GetByName

func (s *DomainService) GetByName(ctx context.Context, domainName string) (Domain, error)

GetByName Gets domain by name.

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 NotFound

type NotFound struct {
	*APIError
}

NotFound Not found error.

func (*NotFound) Unwrap

func (e *NotFound) Unwrap() error

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.

func (*TokenTransport) RoundTrip

func (t *TokenTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes a single HTTP transaction.

func (*TokenTransport) Wrap

func (t *TokenTransport) Wrap(client *http.Client) *http.Client

Wrap wraps an HTTP client Transport with the TokenTransport.

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

func (s *TxtRecordService) Get(ctx context.Context, domainID, recordID int64) (*Record, error)

Get a TXT record. https://api-docs.constellix.com/?version=latest#e7103c53-2ad8-4bc8-b5b3-4c22c4b571b2

func (*TxtRecordService) GetAll

func (s *TxtRecordService) GetAll(ctx context.Context, domainID int64) ([]Record, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL