gostellix

package module
v0.0.0-...-5ec97ca Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: MIT Imports: 10 Imported by: 0

README

gostellix

go client for Constellix API

This is very much a work in progress, with only a subset of features implemented.

It's also primarily/initially intended to support a dnscontrol plugin, so supported features are oriented towards that

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	APIURL     string
	Token      string
	UserAgent  string
	HTTPClient *http.Client
}

Client Client for the Constellix API

func New

func New(apikey, secretkey string) *Client

New Create a new client

func (*Client) APIRequest

func (client *Client) APIRequest(endpoint, params, reqtype string) (response []byte, err error)

APIRequest make an API request

func (*Client) CreateDomainRecord

func (client *Client) CreateDomainRecord(domainID int, record ConstellixRecord) error

CreateDomainRecord add a record to a domain

func (*Client) CreateDomains

func (client *Client) CreateDomains(domains []string) error

CreateDomains Create a list of domains by name

func (*Client) DeleteDomain

func (client *Client) DeleteDomain(id int) error

DeleteDomain delete domain, by integer id

func (*Client) DeleteDomainRecord

func (client *Client) DeleteDomainRecord(domainID int, recordType string, recordID int) error

DeleteDomainRecord delete one domain record

func (*Client) GetAllDomains

func (client *Client) GetAllDomains() ([]ConstellixDomain, error)

GetAllDomains get all domains on the acct

func (*Client) GetDomainByName

func (client *Client) GetDomainByName(name string) (ConstellixDomain, error)

GetDomainByName Get a single domain, by name

func (*Client) GetDomainRecord

func (client *Client) GetDomainRecord(domainID int, recordType string, recordID int) (ConstellixRecord, error)

GetDomainRecord Get one record from a domain, by ID

func (*Client) GetDomainRecords

func (client *Client) GetDomainRecords(domainid int) ([]ConstellixRecord, error)

GetDomainRecords get all records for one domain by domain ID

func (*Client) GetRecordsByDomainName

func (client *Client) GetRecordsByDomainName(domainName string) ([]ConstellixRecord, error)

GetRecordsByDomainName get all records for a domain, by name

func (*Client) ListDomains

func (client *Client) ListDomains() ([]string, error)

ListDomains get a bare list of all domain names

func (*Client) ModifyDomain

func (client *Client) ModifyDomain(domain ConstellixDomain) error

ModifyDomain replace existing Domain

func (*Client) ModifyDomainRecord

func (client *Client) ModifyDomainRecord(domainID int, record ConstellixRecord) error

ModifyDomainRecord add a record to a domain

type ConstellixDomain

type ConstellixDomain struct {
	ID              int            `json:"id,omitempty"`
	Name            string         `json:"name"`
	TypeID          int            `json:"typeId,omitempty"`
	HasGtdRegions   bool           `json:"hasGtdRegions,omitempty"`
	HasGeoIP        bool           `json:"hasGeoIP,omitempty"`
	NameserverGroup int            `json:"nameserverGroup,omitempty"`
	Nameservers     []string       `json:"nameservers,omitempty"`
	CreatedTs       string         `json:"createdTs,omitempty"`
	ModifiedTs      string         `json:"modifiedTs,omitempty"`
	Note            string         `json:"note,omitempty"`
	Version         int            `json:"version,omitempty"`
	Status          string         `json:"status,omitempty"`
	Tags            []string       `json:"tags,omitempty"`
	Soa             *ConstellixSoa `json:"soa,omitempty"`
}

ConstellixDomain holds a domain

type ConstellixRecord

type ConstellixRecord struct {
	ID                 int                    `json:"id,omitempty"`
	Name               string                 `json:"name,omitempty"`
	TTL                int                    `json:"ttl,omitempty"`
	Geolocation        *GeolocationObj        `json:"geolocation,omitempty"`
	RecordOption       string                 `json:"recordOption,omitempty"`
	NoAnswer           bool                   `json:"noAnswer,omitempty"`
	Note               string                 `json:"note,omitempty"`
	GtdRegion          int                    `json:"gtdRegion,omitempty"`
	Type               string                 `json:"type,omitempty"`
	ParentID           int                    `json:"parentId,omitempty"`
	Parent             string                 `json:"parent,omitempty"`
	Source             string                 `json:"source,omitempty"`
	ContactIDs         []int                  `json:"contactIds,omitempty"`
	RoundRobin         []RoundRobinObj        `json:"roundRobin"`
	RecordFailover     *RecordFailoverObj     `json:"recordFailover,omitifempty"`
	Pools              []int                  `json:"pools,omitempty"`
	RoundRobinFailover *RoundRobinFailoverObj `json:"roundRobinFailover"`
	ModifiedTs         int                    `json:"modifiedTs,omitempty"`
	Value              []string               `json:"value,omitempty"`
}

ConstellixRecord domain record

type ConstellixSoa

type ConstellixSoa struct {
	PrimaryNameserver string `json:"primaryNameserver,omitempty"`
	Email             string `json:"email,omitempty"`
	TTL               int    `json:"ttl,omitempty"`
	Serial            int    `json:"serial,omitempty"`
	Refresh           int    `json:"refresh,omitempty"`
	Retry             int    `json:"retry,omitempty"`
	Expire            int    `json:"expire,omitempty"`
	NegCache          int    `json:"negCache,omitempty"`
}

ConstellixSoa holds SOA records

type GeolocationObj

type GeolocationObj struct {
	GeoipUserRegion []int `json:"geoipUserRegion,omitempty"`
	Drop            bool  `json:"drop,omitifempty"`
}

GeolocationObj geolocation info

type RecordFailoverObj

type RecordFailoverObj struct {
	FailoverType int                    `json:"failoverType"`
	Values       []RecordFailoverValues `json:"values"`
	DisableFlag  bool                   `json:"disableFlag"`
}

RecordFailoverObj Failover info

type RecordFailoverValues

type RecordFailoverValues struct {
	Value       string `json:"value"`
	CheckID     string `json:"checkId"`
	DisableFlag string `json:"disableFlag"`
}

RecordFailoverValues Failover values

type RoundRobinFailoverObj

type RoundRobinFailoverObj struct {
	Values      []RoundRobinFailoverObjValues `json:"values"`
	DisableFlag bool                          `json:"disableFlag"`
}

RoundRobinFailoverObj RR Failover Info

type RoundRobinFailoverObjValues

type RoundRobinFailoverObjValues struct {
	Value       string `json:"value"`
	DisableFlag bool   `json:"disableFlag"`
	CheckID     int    `json:"checkId"`
}

RoundRobinFailoverObjValues RR Failover values

type RoundRobinObj

type RoundRobinObj struct {
	Value       string `json:"value"`
	Level       string `json:"level,omitifempty"` // for MX records
	DisableFlag bool   `json:"disableFlag"`
}

RoundRobinObj holds RoundRobin records from a domain

Jump to

Keyboard shortcuts

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