vinyldns

package
v0.0.0-...-be0c653 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const RecordSetLimit = 100

RecordSetLimit is the highest number of records the vinyldns server will allow at once TODO: is there a way to get this limit directly from vinyldns?

Variables

View Source
var Version = "0.9.8"

Version stores the go-vinyldns semantic version

Functions

This section is empty.

Types

type ACLRule

type ACLRule struct {
	AccessLevel string   `json:"accessLevel"`
	Description string   `json:"description,omitempty"`
	UserID      string   `json:"userId,omitempty"`
	GroupID     string   `json:"groupId,omitempty"`
	RecordMask  string   `json:"recordMask,omitempty"`
	RecordTypes []string `json:"recordTypes"`
}

ACLRule represents an ACL rule

type BatchRecordChange

type BatchRecordChange struct {
	ID               string         `json:"id,omitempty"`
	UserName         string         `json:"userName,omitempty"`
	UserID           string         `json:"userId,omitempty"`
	Status           string         `json:"status,omitempty"`
	Comments         string         `json:"comments,omitempty"`
	CreatedTimestamp string         `json:"createdTimestamp,omitempty"`
	OwnerGroupID     string         `json:"ownerGroupId,omitempty"`
	Changes          []RecordChange `json:"changes,omitempty"`
}

BatchRecordChange represents a batch record change API response.

type BatchRecordChangeUpdateResponse

type BatchRecordChangeUpdateResponse struct {
	Comments     string         `json:"comments,omitempty"`
	OwnerGroupID string         `json:"ownerGroupId,omitempty"`
	Changes      []RecordChange `json:"changes,omitempty"`
}

BatchRecordChangeUpdateResponse is represents a batch record change create or update response

type BatchRecordChanges

type BatchRecordChanges struct {
	BatchChanges []RecordChange `json:"batchChanges,omitempty"`
}

BatchRecordChanges represents a list of record changes, as returned by the list batch changes VinylDNS API endpoint.

type Client

type Client struct {
	AccessKey  string
	SecretKey  string
	Host       string
	HTTPClient *http.Client
	UserAgent  string
}

Client is a vinyldns API client.

func NewClient

func NewClient(config ClientConfiguration) *Client

NewClient returns a new vinyldns client using the client ClientConfiguration it's passed.

func NewClientFromEnv

func NewClientFromEnv() *Client

NewClientFromEnv returns a Client configured via environment variables.

func (*Client) BatchRecordChange

func (c *Client) BatchRecordChange(changeID string) (*BatchRecordChange, error)

BatchRecordChange returns the batch record change associated with the change whose ID it's passed.

func (*Client) BatchRecordChangeCreate

func (c *Client) BatchRecordChangeCreate(change *BatchRecordChange) (*BatchRecordChangeUpdateResponse, error)

BatchRecordChangeCreate creates the batch record change it's passed.

func (*Client) BatchRecordChanges

func (c *Client) BatchRecordChanges() ([]RecordChange, error)

BatchRecordChanges returns the list of batch record changes

func (*Client) Group

func (c *Client) Group(groupID string) (*Group, error)

Group gets the Group whose ID it's passed.

func (*Client) GroupActivity

func (c *Client) GroupActivity(groupID string) (*GroupChanges, error)

GroupActivity returns group change activity associated with the Group whose GroupID it's passed.

func (*Client) GroupAdmins

func (c *Client) GroupAdmins(groupID string) ([]User, error)

GroupAdmins returns an array of Users that are admins associated with the Group whose GroupID it's passed.

func (*Client) GroupCreate

func (c *Client) GroupCreate(g *Group) (*Group, error)

GroupCreate creates the Group it's passed.

func (*Client) GroupDelete

func (c *Client) GroupDelete(groupID string) (*Group, error)

GroupDelete deletes the Group whose ID it's passed.

func (*Client) GroupMembers

func (c *Client) GroupMembers(groupID string) ([]User, error)

GroupMembers returns an array of Users that are members associated with the Group whose GroupID it's passed.

func (*Client) GroupUpdate

func (c *Client) GroupUpdate(groupID string, g *Group) (*Group, error)

GroupUpdate updates the Group whose ID it's passed.

func (*Client) Groups

func (c *Client) Groups() ([]Group, error)

Groups retrieves a list of Groups that the requester is a part of.

func (*Client) GroupsListAll

func (c *Client) GroupsListAll(filter ListFilter) ([]Group, error)

GroupsListAll retrieves the complete list of groups with the ListFilter criteria passed. Handles paging through results on the user's behalf.

func (*Client) RecordSet

func (c *Client) RecordSet(zoneID, recordSetID string) (RecordSet, error)

RecordSet retrieves the record matching the Zone ID and RecordSet ID it's passed.

func (*Client) RecordSetChange

func (c *Client) RecordSetChange(zoneID, recordSetID, changeID string) (*RecordSetChange, error)

RecordSetChange retrieves the RecordSetChange matching the Zone, RecordSet, and Change IDs it's passed.

func (*Client) RecordSetChanges

func (c *Client) RecordSetChanges(zoneID string, f ListFilter) (*RecordSetChanges, error)

RecordSetChanges retrieves the RecordSetChanges response for the Zone and ListFilter it's passed.

func (*Client) RecordSetChangesListAll

func (c *Client) RecordSetChangesListAll(zoneID string, filter ListFilter) ([]RecordSetChange, error)

RecordSetChangesListAll retrieves the complete list of record set changes for the Zone ListFilter criteria passed. Handles paging through results on the user's behalf.

func (*Client) RecordSetCollector

func (c *Client) RecordSetCollector(zoneID string, limit int) (func() ([]RecordSet, error), error)

RecordSetCollector creates a function to retrieve the next set of recordsets. To retrieve *all* recordsets, call that function repeatedly until err == // io.EOF

func (*Client) RecordSetCreate

func (c *Client) RecordSetCreate(rs *RecordSet) (*RecordSetUpdateResponse, error)

RecordSetCreate creates the RecordSet it's passed in the Zone whose ID it's passed.

func (*Client) RecordSetDelete

func (c *Client) RecordSetDelete(zoneID, recordSetID string) (*RecordSetUpdateResponse, error)

RecordSetDelete deletes the RecordSet matching the Zone ID and RecordSet ID it's passed.

func (*Client) RecordSetUpdate

func (c *Client) RecordSetUpdate(rs *RecordSet) (*RecordSetUpdateResponse, error)

RecordSetUpdate updates the RecordSet matching the Zone ID and RecordSetID it's passed.

func (*Client) RecordSets

func (c *Client) RecordSets(id string) ([]RecordSet, error)

RecordSets retrieves a list of RecordSets from a Zone.

func (*Client) RecordSetsListAll

func (c *Client) RecordSetsListAll(zoneID string, filter ListFilter) ([]RecordSet, error)

RecordSetsListAll retrieves the complete list of record sets with the ListFilter criteria passed. Handles paging through results on the user's behalf.

func (*Client) Zone

func (c *Client) Zone(id string) (Zone, error)

Zone retrieves the Zone whose ID it's passed.

func (*Client) ZoneByID

func (c *Client) ZoneByID(id string) (Zone, error)

ZoneByID retrieves the Zone whose ID it's passed. It is a version of Zone whose func name is a bit more explicit.

func (*Client) ZoneByName

func (c *Client) ZoneByName(name string) (Zone, error)

ZoneByName retrieves the Zone whose name it's passed.

func (*Client) ZoneChange

func (c *Client) ZoneChange(zoneID, zoneChangeID string) (ZoneChange, error)

ZoneChange retrieves the ZoneChange matching the Zone ID and and ZoneChange ID it's passed.

func (*Client) ZoneChanges

func (c *Client) ZoneChanges(id string) (*ZoneChanges, error)

ZoneChanges retrieves the ZoneChanges for the Zone whose ID it's passed.

func (*Client) ZoneChangesListAll

func (c *Client) ZoneChangesListAll(zoneID string, filter ListFilter) ([]ZoneChange, error)

ZoneChangesListAll retrieves the complete list of zone changes with the ListFilter criteria passed. Handles paging through results on the user's behalf.

func (*Client) ZoneCreate

func (c *Client) ZoneCreate(z *Zone) (*ZoneUpdateResponse, error)

ZoneCreate creates the Zone it's passed.

func (*Client) ZoneDelete

func (c *Client) ZoneDelete(zoneID string) (*ZoneUpdateResponse, error)

ZoneDelete deletes the Zone whose ID it's passed.

func (*Client) ZoneExists

func (c *Client) ZoneExists(zoneID string) (bool, error)

ZoneExists returns true if a zone request does not 404 Otherwise, it returns false

func (*Client) ZoneUpdate

func (c *Client) ZoneUpdate(z *Zone) (*ZoneUpdateResponse, error)

ZoneUpdate updates the Zone whose ID it's passed.

func (*Client) Zones

func (c *Client) Zones() ([]Zone, error)

Zones retrieves the list of zones a user has access to.

func (*Client) ZonesListAll

func (c *Client) ZonesListAll(filter ListFilter) ([]Zone, error)

ZonesListAll retrieves the complete list of zones with the ListFilter criteria passed. Handles paging through results on the user's behalf.

type ClientConfiguration

type ClientConfiguration struct {
	AccessKey string
	SecretKey string
	Host      string
	UserAgent string
}

ClientConfiguration represents the vinyldns client configuration.

func NewConfigFromEnv

func NewConfigFromEnv() ClientConfiguration

NewConfigFromEnv creates a new ClientConfiguration using environment variables.

type Error

type Error struct {
	RequestURL    string
	RequestMethod string
	RequestBody   string
	ResponseBody  string
	ResponseCode  int
}

Error represents an error from the vinyldns API

func (Error) Error

func (d Error) Error() string

type Group

type Group struct {
	ID          string `json:"id,omitempty"`
	Name        string `json:"name"`
	Email       string `json:"email,omitempty"`
	Description string `json:"description,omitempty"`
	Status      string `json:"status,omitempty"`
	Created     string `json:"created,omitempty"`
	Members     []User `json:"members"`
	Admins      []User `json:"admins"`
}

Group represents a vinyldns group.

type GroupAdmins

type GroupAdmins struct {
	GroupAdmins []User `json:"admins"`
}

GroupAdmins is a slice of Users

type GroupChange

type GroupChange struct {
	UserID     string `json:"userId,omitempty"`
	Created    string `json:"created,omitempty"`
	ChangeType string `json:"changeType,omitempty"`
	NewGroup   Group  `json:"newGroup,omitempty"`
	OldGroup   Group  `json:"oldGroup,omitempty"`
}

GroupChange represents a group change event object.

type GroupChanges

type GroupChanges struct {
	Changes []GroupChange `json:"changes"`
}

GroupChanges is represents the group changes.

type GroupMembers

type GroupMembers struct {
	GroupMembers []User `json:"members"`
}

GroupMembers is a slice of Users

type Groups

type Groups struct {
	Groups          []Group `json:"groups"`
	GroupNameFilter string  `json:"groupNameFilter,omitempty"`
	MaxItems        int     `json:"maxItems,omitempty"`
	NextID          string  `json:"nextId,omitempty"`
	StartFrom       string  `json:"startFrom,omitempty"`
}

Groups is a slice of groups

type ListFilter

type ListFilter struct {
	NameFilter string
	StartFrom  string
	MaxItems   int
}

ListFilter represents the list query parameters that may be passed to VinylDNS API endpoints such as /zones and /recordsets

type Record

type Record struct {
	Address     string `json:"address,omitempty"`
	CName       string `json:"cname,omitempty"`
	Preference  int    `json:"preference,omitempty"`
	Exchange    string `json:"exchange,omitempty"`
	NSDName     string `json:"nsdname,omitempty"`
	PTRDName    string `json:"ptrdname,omitempty"`
	MName       string `json:"mname,omitempty"`
	RName       string `json:"rname,omitempty"`
	Serial      int    `json:"serial,omitempty"`
	Refresh     int    `json:"refresh,omitempty"`
	Retry       int    `json:"retry,omitempty"`
	Expire      int    `json:"expire,omitempty"`
	Minimum     int    `json:"minimum,omitempty"`
	Text        string `json:"text,omitempty"`
	Priority    int    `json:"priority,omitempty"`
	Weight      int    `json:"weight,omitempty"`
	Port        int    `json:"port,omitempty"`
	Target      string `json:"target,omitempty"`
	Algorithm   string `json:"algorithm,omitempty"`
	Type        string `json:"type,omitempty"`
	Fingerprint string `json:"fingerprint,omitempty"`
}

Record represents a DNS record

type RecordChange

type RecordChange struct {
	ID               string     `json:"id,omitempty"`
	Status           string     `json:"status,omitempty"`
	ChangeType       string     `json:"changeType,omitempty"`
	RecordName       string     `json:"recordName,omitempty"`
	TTL              int        `json:"ttl,omitempty"`
	Type             string     `json:"type,omitempty"`
	ZoneName         string     `json:"zoneName,omitempty"`
	InputName        string     `json:"inputName,omitempty"`
	ZoneID           string     `json:"zoneId,omitempty"`
	TotalChanges     int        `json:"totalChanges,omitempty"`
	UserName         string     `json:"userName,omitempty"`
	Comments         string     `json:"comments,omitempty"`
	UserID           string     `json:"userId,omitempty"`
	CreatedTimestamp string     `json:"createdTimestamp,omitempty"`
	Record           RecordData `json:"record,omitempty"`
	OwnerGroupID     string     `json:"ownerGroupId,omitempty"`
}

RecordChange represents an individual batch record change.

type RecordData

type RecordData struct {
	Address  string `json:"address,omitempty"`
	CName    string `json:"cname,omitempty"`
	PTRDName string `json:"ptrdname,omitempty"`
}

RecordData is represents a batch record change record data.

type RecordSet

type RecordSet struct {
	ID           string   `json:"id,omitempty"`
	ZoneID       string   `json:"zoneId"`
	OwnerGroupID string   `json:"ownerGroupId,omitempty"`
	Name         string   `json:"name,omitempty"`
	Type         string   `json:"type"`
	Status       string   `json:"status,omitempty"`
	Created      string   `json:"created,omitempty"`
	Updated      string   `json:"updated,omitempty"`
	TTL          int      `json:"ttl"`
	Account      string   `json:"account"`
	Records      []Record `json:"records"`
}

RecordSet represents a DNS record set.

type RecordSetChange

type RecordSetChange struct {
	Zone       Zone      `json:"zone"`
	RecordSet  RecordSet `json:"recordSet"`
	UserID     string    `json:"userId"`
	ChangeType string    `json:"changeType"`
	Status     string    `json:"status"`
	Created    string    `json:"created"`
	ID         string    `json:"id"`
}

RecordSetChange represents a record set change.

type RecordSetChanges

type RecordSetChanges struct {
	RecordSetChanges []RecordSetChange `json:"recordSetChanges"`
	ZoneID           string            `json:"zoneId,omitempty"`
	StartFrom        string            `json:"startFrom,omitempty"`
	NextID           string            `json:"nextId,omitempty"`
	MaxItems         int               `json:"maxItems,omitempty"`
	Status           string            `json:"status,omitempty"`
}

RecordSetChanges represents a recordset changes response

type RecordSetResponse

type RecordSetResponse struct {
	RecordSet RecordSet `json:"recordSet"`
}

RecordSetResponse represents the JSON response from the record set endpoint.

type RecordSetUpdateResponse

type RecordSetUpdateResponse struct {
	Zone      Zone      `json:"zone"`
	RecordSet RecordSet `json:"recordSet"`
	ChangeID  string    `json:"id"`
	Status    string    `json:"status"`
}

RecordSetUpdateResponse represents a JSON response from the record set update endpoint.

type RecordSetsResponse

type RecordSetsResponse struct {
	NextID           string      `json:"nextId,omitempty"`
	MaxItems         int         `json:"maxItems,omitempty"`
	StartFrom        string      `json:"startFrom,omitempty"`
	RecordNameFilter string      `json:"recordNameFilter,omitempty"`
	RecordSets       []RecordSet `json:"recordSets"`
}

RecordSetsResponse represents the JSON response from the record sets endpoint.

type User

type User struct {
	ID        string `json:"id,omitempty"`
	UserName  string `json:"userName,omitempty"`
	FirstName string `json:"firstName,omitempty"`
	LastName  string `json:"lastName,omitempty"`
	Email     string `json:"email,omitempty"`
	Created   string `json:"created,omitempty"`
}

User represents a vinyldns user.

type Zone

type Zone struct {
	Name               string          `json:"name,omitempty"`
	Email              string          `json:"email,omitempty"`
	Status             string          `json:"status,omitempty"`
	Created            string          `json:"created,omitempty"`
	ID                 string          `json:"id,omitempty"`
	AdminGroupID       string          `json:"adminGroupId,omitempty"`
	LatestSync         string          `json:"latestSync,omitempty"`
	Updated            string          `json:"updated,omitempty"`
	Connection         *ZoneConnection `json:"connection,omitempty"`
	TransferConnection *ZoneConnection `json:"transferConnection,omitempty"`
	ACL                *ZoneACL        `json:"acl,omitempty"`
	Shared             bool            `json:"shared,omitempty"`
}

Zone represents a zone

type ZoneACL

type ZoneACL struct {
	Rules []ACLRule `json:"rules"`
}

ZoneACL represents a zone ACL

type ZoneChange

type ZoneChange struct {
	Zone       Zone   `json:"zone"`
	UserID     string `json:"userId"`
	ChangeType string `json:"changeType"`
	Status     string `json:"status"`
	Created    string `json:"created"`
	ID         string `json:"id"`
}

ZoneChange represents a zone change

type ZoneChanges

type ZoneChanges struct {
	ZoneID      string       `json:"zoneId"`
	ZoneChanges []ZoneChange `json:"zoneChanges"`
	StartFrom   string       `json:"startFrom"`
	MaxItems    int          `json:"maxItems"`
	NextID      string       `json:"nextId"`
}

ZoneChanges represents the zone changes

type ZoneConnection

type ZoneConnection struct {
	Name          string `json:"name,omitempty"`
	KeyName       string `json:"keyName,omitempty"`
	Key           string `json:"key,omitempty"`
	PrimaryServer string `json:"primaryServer,omitempty"`
}

ZoneConnection represents a zone connection

type ZoneResponse

type ZoneResponse struct {
	Zone Zone `json:"zone"`
}

ZoneResponse represents the JSON response from the zone endpoint

type ZoneUpdateResponse

type ZoneUpdateResponse struct {
	Zone       Zone   `json:"zone"`
	UserID     string `json:"userId"`
	ChangeType string `json:"changeType"`
	Status     string `json:"status"`
	Created    string `json:"created"`
	ID         string `json:"id"`
}

ZoneUpdateResponse represents the JSON response from the zone update endpoint

type Zones

type Zones struct {
	Zones     []Zone `json:"zones"`
	StartFrom string `json:"startFrom"`
	MaxItems  int    `json:"maxItems"`
	NextID    string `json:"nextId"`
}

Zones is a slice of zones

Jump to

Keyboard shortcuts

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