udnssdk

package module
Version: v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 14 Imported by: 9

README

udnssdk - An UltraDNS SDK for Go

This is a golang SDK for the UltraDNS REST API. It's not feature complete, and currently is only known to be used for Terraform's ultradns provider.

Full API docs are available at godoc

Example

package main

import (
	"fmt"
	"log"

	"github.com/terra-farm/udnssdk"
)

func main() {
	client := udnssdk.NewClient("username", "password", udnssdk.DefaultTestBaseURL)
	if client == nil {
		log.Fatalf("Failed to create client")
	}

	fmt.Printf("---- Query RRSets\n")
	rrsetkey := RRSetKey{
		Zone: "domain.com",
		Type: "ANY",
		Name: "",
	}
	rrsets, err := client.RRSets.Select(rrsetkey)
	if err != nil {
		log.Fatalf(err)
	}
	fmt.Printf("%+v\n", rrsets)

	fmt.Printf("---- Create RRSet\n")
	rrsetkey = RRSetKey{
		Zone: "domain.com",
		Type: "A",
		Name: "test",
	}
	rrset := udnssdk.RRSet{
		OwnerName: r.Name,
		RRType:    r.Type,
		TTL:       300,
		RData:     []string{"127.0.0.1"},
	}
	resp, err := client.RRSets.Create(rrsetkey, rrset)
	if err != nil {
		log.Fatalf(err)
	}
	fmt.Printf("Response: %+v\n", resp)

	fmt.Printf("---- Update RRSet\n")
	rrset = udnssdk.RRSet{
		OwnerName: r.Name,
		RRType:    r.Type,
		TTL:       300,
		RData:     []string{"127.0.0.2"},
	}
	resp, err := client.RRSets.Update(rrsetkey, rrset)
	if err != nil {
		log.Fatalf(err)
	}
	fmt.Printf("Response: %+v\n", resp)

	fmt.Printf("---- Delete RRSet\n")
	resp, err := client.RRSets.Delete(rrsetkey)
	if err != nil {
		log.Fatalf(err)
	}
	fmt.Printf("Response: %+v\n", resp)
}

Thanks

Documentation

Index

Constants

View Source
const (
	// DirPoolSchema is the schema URI for a Directional pool profile
	DirPoolSchema ProfileSchema = "http://schemas.ultradns.com/DirPool.jsonschema"
	// RDPoolSchema is the schema URI for a Resource Distribution pool profile
	RDPoolSchema = "http://schemas.ultradns.com/RDPool.jsonschema"
	// SBPoolSchema is the schema URI for a SiteBacker pool profile
	SBPoolSchema = "http://schemas.ultradns.com/SBPool.jsonschema"
	// TCPoolSchema is the schema URI for a Traffic Controller pool profile
	TCPoolSchema = "http://schemas.ultradns.com/TCPool.jsonschema"
)
View Source
const (

	// DefaultTestBaseURL returns the URL for UltraDNS's test restapi endpoint
	DefaultTestBaseURL = "https://test-restapi.ultradns.com/"
	// DefaultLiveBaseURL returns the URL for UltraDNS's production restapi endpoint
	DefaultLiveBaseURL = "https://restapi.ultradns.com/"
)

Variables

This section is empty.

Functions

func AccountsURI

func AccountsURI() string

AccountsURI generates the URI for Accounts collection

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if the status code is different than 2xx. Specific requests may have additional requirements, but this is sufficient in most of the cases.

func Endpoint added in v1.2.0

func Endpoint(BaseURL string) oauth2.Endpoint

Endpoint returns an oauth2.Endpoint for UltraDNS

func NewConfig added in v1.2.0

func NewConfig(username, password, BaseURL string) *oauthPassword.Config

NewConfig creates a new *password.config for UltraDNS OAuth2

func TasksQueryURI

func TasksQueryURI(query string, offset int) string

TasksQueryURI generates the query URI for the tasks collection given a query and offset

func TokenURL added in v1.2.0

func TokenURL(BaseURL string) string

TokenURL returns an OAuth2 TokenURL for UltraDNS

Types

type Account

type Account struct {
	AccountName           string `json:"accountName"`
	AccountHolderUserName string `json:"accountHolderUserName"`
	OwnerUserName         string `json:"ownerUserName"`
	NumberOfUsers         int    `json:"numberOfUsers"`
	NumberOfGroups        int    `json:"numberOfGroups"`
	AccountType           string `json:"accountType"`
}

Account represents responses from the service

type AccountKey

type AccountKey string

AccountKey represents the string identifier of an Account

func (AccountKey) URI

func (k AccountKey) URI() string

URI generates the URI for an Account

type AccountLevelGeoDirectionalGroupDTO

type AccountLevelGeoDirectionalGroupDTO struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Codes       []string `json:"codes"`
}

AccountLevelGeoDirectionalGroupDTO wraps an account-level, geo directonal-group response

type AccountLevelGeoDirectionalGroupListDTO

type AccountLevelGeoDirectionalGroupListDTO struct {
	AccountName string                               `json:"zoneName"`
	GeoGroups   []AccountLevelGeoDirectionalGroupDTO `json:"geoGroups"`
	Queryinfo   QueryInfo                            `json:"queryInfo"`
	Resultinfo  ResultInfo                           `json:"resultInfo"`
}

AccountLevelGeoDirectionalGroupListDTO wraps a list of account-level, geo directional-groups response from a index request

type AccountLevelIPDirectionalGroupDTO

type AccountLevelIPDirectionalGroupDTO struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	IPs         []IPAddrDTO `json:"ips"`
}

AccountLevelIPDirectionalGroupDTO wraps an account-level, IP directional-group response

type AccountLevelIPDirectionalGroupListDTO

type AccountLevelIPDirectionalGroupListDTO struct {
	AccountName string                              `json:"zoneName"`
	IPGroups    []AccountLevelIPDirectionalGroupDTO `json:"ipGroups"`
	Queryinfo   QueryInfo                           `json:"queryInfo"`
	Resultinfo  ResultInfo                          `json:"resultInfo"`
}

AccountLevelIPDirectionalGroupListDTO wraps an account-level, IP directional-group response

type AccountListDTO

type AccountListDTO struct {
	Accounts   []Account  `json:"accounts"`
	Resultinfo ResultInfo `json:"resultInfo"`
}

AccountListDTO represents a account index response

type AccountsService

type AccountsService struct {
	// contains filtered or unexported fields
}

AccountsService provides access to account resources

func (*AccountsService) Delete

func (s *AccountsService) Delete(k AccountKey) (*http.Response, error)

Delete requests deletion of an Account by AccountKey

func (*AccountsService) Find

Find requests an Account by AccountKey

func (*AccountsService) Select

func (s *AccountsService) Select() ([]Account, *http.Response, error)

Select requests all Accounts of user

type AlertsService

type AlertsService struct {
	// contains filtered or unexported fields
}

AlertsService manages Alerts

func (*AlertsService) Select

func (s *AlertsService) Select(k RRSetKey) ([]ProbeAlertDataDTO, error)

Select returns all probe alerts with a RRSetKey

func (*AlertsService) SelectWithOffset

func (s *AlertsService) SelectWithOffset(k RRSetKey, offset int) ([]ProbeAlertDataDTO, ResultInfo, *http.Response, error)

SelectWithOffset returns the probe alerts with a RRSetKey, accepting an offset

type BackupRecord

type BackupRecord struct {
	RData            string `json:"rdata,omitempty"`
	FailoverDelay    int    `json:"failoverDelay,omitempty"`
	AvailableToServe bool   `json:"availableToServe,omitempty"`
}

BackupRecord wraps the backupRecord objects of an SBPoolProfile response

type Client

type Client struct {
	// This is our client structure.
	HTTPClient *http.Client
	Config     *oauthPassword.Config

	BaseURL   *url.URL
	UserAgent string

	// Accounts API
	Accounts *AccountsService
	// Probe Alerts API
	Alerts *AlertsService
	// Directional Pools API
	DirectionalPools *DirectionalPoolsService
	// Events API
	Events *EventsService
	// Notifications API
	Notifications *NotificationsService
	// Probes API
	Probes *ProbesService
	// Resource Record Sets API
	RRSets *RRSetsService
	// Tasks API
	Tasks *TasksService
}

Client wraps our general-purpose Service Client

func NewClient

func NewClient(username, password, baseURL string) (*Client, error)

NewClient returns a new ultradns API client.

func (*Client) Do

func (c *Client) Do(method, path string, payload, v interface{}) (*http.Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to decode it.

func (*Client) GetResultByURI

func (c *Client) GetResultByURI(uri string) (*http.Response, error)

GetResultByURI just requests a URI

func (*Client) NewRequest

func (c *Client) NewRequest(method, pathquery string, payload interface{}) (*http.Request, error)

NewRequest creates an API request. The path is expected to be a relative path and will be resolved according to the BaseURL of the Client. Paths should always be specified without a preceding slash.

type DNSProbeDetailsDTO

type DNSProbeDetailsDTO struct {
	Port       int                             `json:"port,omitempty"`
	TCPOnly    bool                            `json:"tcpOnly,omitempty"`
	RecordType string                          `json:"type,omitempty"`
	OwnerName  string                          `json:"ownerName,omitempty"`
	Limits     map[string]ProbeDetailsLimitDTO `json:"limits"`
}

DNSProbeDetailsDTO wraps DNS probe details

type DPRDataInfo

type DPRDataInfo struct {
	AllNonConfigured bool     `json:"allNonConfigured,omitempty" terraform:"all_non_configured"`
	IPInfo           *IPInfo  `json:"ipInfo,omitempty" terraform:"ip_info"`
	GeoInfo          *GeoInfo `json:"geoInfo,omitempty" terraform:"geo_info"`
	Type             string   `json:"type,omitempty" terraform:"type"` // not mentioned in REST API doc
}

DPRDataInfo wraps the rdataInfo object of a DirPoolProfile response

type DirPoolProfile

type DirPoolProfile struct {
	Context         ProfileSchema `json:"@context"`
	Description     string        `json:"description"`
	ConflictResolve string        `json:"conflictResolve,omitempty"`
	RDataInfo       []DPRDataInfo `json:"rdataInfo"`
	NoResponse      DPRDataInfo   `json:"noResponse,omitempty"`
}

DirPoolProfile wraps a Profile for a Directional Pool

func (DirPoolProfile) RawProfile

func (p DirPoolProfile) RawProfile() RawProfile

RawProfile converts to a naive RawProfile

type DirectionalPool

type DirectionalPool struct {
	DirectionalPoolID         string `json:"taskId"`
	DirectionalPoolStatusCode string `json:"taskStatusCode"`
	Message                   string `json:"message"`
	ResultURI                 string `json:"resultUri"`
}

DirectionalPool wraps an account-level directional-groups response from a index request

type DirectionalPoolKey

type DirectionalPoolKey struct {
	Account AccountKey
	Type    string
	Name    string
}

DirectionalPoolKey collects the identifiers of a DirectionalPool

func (DirectionalPoolKey) QueryURI

func (k DirectionalPoolKey) QueryURI(query string, offset int) string

QueryURI generates the URI for directional pools by account, type, query & offset

func (DirectionalPoolKey) URI

func (k DirectionalPoolKey) URI() string

URI generates the URI for directional pools by account, type & slug ID

type DirectionalPoolListDTO

type DirectionalPoolListDTO struct {
	DirectionalPools []DirectionalPool `json:"tasks"`
	Queryinfo        QueryInfo         `json:"queryInfo"`
	Resultinfo       ResultInfo        `json:"resultInfo"`
}

DirectionalPoolListDTO wraps a list of account-level directional-groups response from a index request

type DirectionalPoolsService

type DirectionalPoolsService struct {
	// contains filtered or unexported fields
}

DirectionalPoolsService manages 'account level' 'geo' and 'ip' groups for directional-pools

func (*DirectionalPoolsService) Geos

Geos allows access to the Geo DirectionalPools API

func (*DirectionalPoolsService) IPs

IPs allows access to the IP DirectionalPools API

type ErrorResponse

type ErrorResponse struct {
	Response         *http.Response // HTTP response that caused this error
	ErrorCode        int            `json:"errorCode"`    //  error code
	ErrorMessage     string         `json:"errorMessage"` // human-readable message
	ErrorStr         string         `json:"error"`
	ErrorDescription string         `json:"error_description"`
}

ErrorResponse represents an error caused by an API request. Example: {"errorCode":60001,"errorMessage":"invalid_grant:Invalid username & password combination.","error":"invalid_grant","error_description":"60001: invalid_grant:Invalid username & password combination."}

func (ErrorResponse) Error

func (r ErrorResponse) Error() string

Error implements the error interface.

type ErrorResponseList

type ErrorResponseList struct {
	Response  *http.Response // HTTP response that caused this error
	Responses []ErrorResponse
}

ErrorResponseList wraps an HTTP response that has a list of errors

func (ErrorResponseList) Error

func (r ErrorResponseList) Error() string

type EventInfoDTO

type EventInfoDTO struct {
	ID         string    `json:"id"`
	PoolRecord string    `json:"poolRecord"`
	EventType  string    `json:"type"`
	Start      time.Time `json:"start"`
	Repeat     string    `json:"repeat"`
	End        time.Time `json:"end"`
	Notify     string    `json:"notify"`
}

EventInfoDTO wraps an event's info response

type EventInfoListDTO

type EventInfoListDTO struct {
	Events     []EventInfoDTO `json:"events"`
	Queryinfo  QueryInfo      `json:"queryInfo"`
	Resultinfo ResultInfo     `json:"resultInfo"`
}

EventInfoListDTO wraps a list of event info and list metadata, from an index request

type EventKey

type EventKey struct {
	Zone string
	Type string
	Name string
	GUID string
}

EventKey collects the identifiers of an Event

func (EventKey) RRSetKey

func (p EventKey) RRSetKey() RRSetKey

RRSetKey generates the RRSetKey for the EventKey

func (EventKey) URI

func (p EventKey) URI() string

URI generates the URI for a probe

type EventsService

type EventsService struct {
	// contains filtered or unexported fields
}

EventsService manages Events

func (*EventsService) Create

func (s *EventsService) Create(r RRSetKey, ev EventInfoDTO) (*http.Response, error)

Create requests creation of an event by RRSetKey, with provided event-info, returning actual response or an error

func (*EventsService) Delete

func (s *EventsService) Delete(e EventKey) (*http.Response, error)

Delete requests deletion of an event by EventKey, returning the actual response or an error

func (*EventsService) Find

Find requests an event by name, type, zone & guid, also returning the actual response, or an error

func (*EventsService) Select

func (s *EventsService) Select(r RRSetKey, query string) ([]EventInfoDTO, error)

Select requests all events, using pagination and error handling

func (*EventsService) SelectWithOffset

func (s *EventsService) SelectWithOffset(r RRSetKey, query string, offset int) ([]EventInfoDTO, ResultInfo, *http.Response, error)

SelectWithOffset requests list of events by RRSetKey, query and offset, also returning list metadata, the actual response, or an error

func (*EventsService) Update

func (s *EventsService) Update(e EventKey, ev EventInfoDTO) (*http.Response, error)

Update requests update of an event by EventKey, withprovided event-info, returning the actual response or an error

type FTPProbeDetailsDTO

type FTPProbeDetailsDTO struct {
	Port        int                             `json:"port,omitempty"`
	PassiveMode bool                            `json:"passiveMode,omitempty"`
	Username    string                          `json:"username,omitempty"`
	Password    string                          `json:"password,omitempty"`
	Path        string                          `json:"path"`
	Limits      map[string]ProbeDetailsLimitDTO `json:"limits"`
}

FTPProbeDetailsDTO wraps FTP probe details

type GeoDirectionalPoolKey

type GeoDirectionalPoolKey struct {
	Account AccountKey
	Name    string
}

GeoDirectionalPoolKey collects the identifiers of an DirectionalPool with type Geo

func (GeoDirectionalPoolKey) DirectionalPoolKey

func (k GeoDirectionalPoolKey) DirectionalPoolKey() DirectionalPoolKey

DirectionalPoolKey generates the DirectionalPoolKey for the GeoDirectionalPoolKey

func (GeoDirectionalPoolKey) QueryURI

func (k GeoDirectionalPoolKey) QueryURI(query string, offset int) string

QueryURI generates the GeoDirectionalPool URI with query

func (GeoDirectionalPoolKey) URI

func (k GeoDirectionalPoolKey) URI() string

URI generates the URI for a GeoDirectionalPool

type GeoDirectionalPoolsService

type GeoDirectionalPoolsService struct {
	// contains filtered or unexported fields
}

GeoDirectionalPoolsService manages 'geo' groups for directional-pools

func (*GeoDirectionalPoolsService) Create

func (s *GeoDirectionalPoolsService) Create(k GeoDirectionalPoolKey, val interface{}) (*http.Response, error)

Create requests creation of a DirectionalPool by DirectionalPoolKey given a directional-pool

func (*GeoDirectionalPoolsService) Delete

Delete requests deletion of a DirectionalPool

func (*GeoDirectionalPoolsService) Find

Find requests a geo directional-pool by name & account

func (*GeoDirectionalPoolsService) Select

Select requests all geo directional-pools, by query and account, providing pagination and error handling

func (*GeoDirectionalPoolsService) SelectWithOffset

SelectWithOffset requests list of geo directional-pools, by query & account, and an offset, returning the directional-group, the list-metadata, the actual response, or an error

func (*GeoDirectionalPoolsService) Update

func (s *GeoDirectionalPoolsService) Update(k GeoDirectionalPoolKey, val interface{}) (*http.Response, error)

Update requests update of a DirectionalPool by DirectionalPoolKey given a directional-pool

type GeoInfo

type GeoInfo struct {
	Name           string   `json:"name" terraform:"name"`
	IsAccountLevel bool     `json:"isAccountLevel,omitempty" terraform:"is_account_level"`
	Codes          []string `json:"codes,omitempty" terraform:"-"`
}

GeoInfo wraps the geoInfo object of a DPRDataInfo

type HTTPProbeDetailsDTO

type HTTPProbeDetailsDTO struct {
	Transactions []Transaction         `json:"transactions"`
	TotalLimits  *ProbeDetailsLimitDTO `json:"totalLimits,omitempty"`
}

HTTPProbeDetailsDTO wraps HTTP probe details

type IPAddrDTO

type IPAddrDTO struct {
	Start   string `json:"start,omitempty" terraform:"start"`
	End     string `json:"end,omitempty" terraform:"end"`
	CIDR    string `json:"cidr,omitempty" terraform:"cidr"`
	Address string `json:"address,omitempty" terraform:"address"`
}

IPAddrDTO wraps an IP address range or CIDR block

type IPDirectionalPoolKey

type IPDirectionalPoolKey struct {
	Account AccountKey
	Name    string
}

IPDirectionalPoolKey collects the identifiers of an DirectionalPool with type IP

func (IPDirectionalPoolKey) DirectionalPoolKey

func (k IPDirectionalPoolKey) DirectionalPoolKey() DirectionalPoolKey

DirectionalPoolKey generates the DirectionalPoolKey for the IPDirectionalPoolKey

func (IPDirectionalPoolKey) QueryURI

func (k IPDirectionalPoolKey) QueryURI(query string, offset int) string

QueryURI generates the IPDirectionalPool URI with query

func (IPDirectionalPoolKey) URI

func (k IPDirectionalPoolKey) URI() string

URI generates the IPDirectionalPool query URI

type IPDirectionalPoolsService

type IPDirectionalPoolsService struct {
	// contains filtered or unexported fields
}

IPDirectionalPoolsService manages 'geo' groups for directional-pools

func (*IPDirectionalPoolsService) Create

func (s *IPDirectionalPoolsService) Create(k IPDirectionalPoolKey, val interface{}) (*http.Response, error)

Create requests creation of a DirectionalPool by DirectionalPoolKey given a directional-pool

func (*IPDirectionalPoolsService) Delete

Delete deletes an directional-pool

func (*IPDirectionalPoolsService) Find

Find requests a directional-pool by name & account

func (*IPDirectionalPoolsService) Select

Select requests all IP directional-pools, using pagination and error handling

func (*IPDirectionalPoolsService) SelectWithOffset

SelectWithOffset requests all IP directional-pools, by query & account, and an offset, returning the list of IP groups, list metadata & the actual response, or an error

func (*IPDirectionalPoolsService) Update

func (s *IPDirectionalPoolsService) Update(k IPDirectionalPoolKey, val interface{}) (*http.Response, error)

Update requests update of a DirectionalPool by DirectionalPoolKey given a directional-pool

type IPInfo

type IPInfo struct {
	Name           string      `json:"name" terraform:"name"`
	IsAccountLevel bool        `json:"isAccountLevel,omitempty" terraform:"is_account_level"`
	Ips            []IPAddrDTO `json:"ips,omitempty" terraform:"-"`
}

IPInfo wraps the ipInfo object of a DPRDataInfo

type NotificationDTO

type NotificationDTO struct {
	Email       string                   `json:"email"`
	PoolRecords []NotificationPoolRecord `json:"poolRecords"`
}

NotificationDTO manages notifications

type NotificationInfoDTO

type NotificationInfoDTO struct {
	Probe     bool `json:"probe"`
	Record    bool `json:"record"`
	Scheduled bool `json:"scheduled"`
}

NotificationInfoDTO does things unknown

type NotificationKey

type NotificationKey struct {
	Zone  string
	Type  string
	Name  string
	Email string
}

NotificationKey collects the identifiers of an Notification

func (NotificationKey) RRSetKey

func (k NotificationKey) RRSetKey() RRSetKey

RRSetKey generates the RRSetKey for the NotificationKey

func (NotificationKey) URI

func (k NotificationKey) URI() string

URI generates the URI for a probe

type NotificationListDTO

type NotificationListDTO struct {
	Notifications []NotificationDTO `json:"notifications"`
	Queryinfo     QueryInfo         `json:"queryInfo"`
	Resultinfo    ResultInfo        `json:"resultInfo"`
}

NotificationListDTO does things unknown

type NotificationPoolRecord

type NotificationPoolRecord struct {
	PoolRecord   string              `json:"poolRecord"`
	Notification NotificationInfoDTO `json:"notification"`
}

NotificationPoolRecord does things unknown

type NotificationsService

type NotificationsService struct {
	// contains filtered or unexported fields
}

NotificationsService manages Probes

func (*NotificationsService) Create

Create requests creation of an event by RRSetKey, with provided NotificationInfoDTO, returning actual response or an error

func (*NotificationsService) Delete

Delete requests deletion of an event by NotificationKey, returning the actual response or an error

func (*NotificationsService) Find

Find requests a notification by NotificationKey,returning the actual response, or an error

func (*NotificationsService) Select

Select requests all notifications by RRSetKey and optional query, using pagination and error handling

func (*NotificationsService) SelectWithOffset

func (s *NotificationsService) SelectWithOffset(k RRSetKey, query string, offset int) ([]NotificationDTO, ResultInfo, *http.Response, error)

SelectWithOffset requests list of notifications by RRSetKey, query and offset, also returning list metadata, the actual response, or an error

func (*NotificationsService) Update

Update requests update of an event by NotificationKey, with provided NotificationInfoDTO, returning the actual response or an error

type PingProbeDetailsDTO

type PingProbeDetailsDTO struct {
	Packets    int                             `json:"packets,omitempty"`
	PacketSize int                             `json:"packetSize,omitempty"`
	Limits     map[string]ProbeDetailsLimitDTO `json:"limits"`
}

PingProbeDetailsDTO wraps Ping probe details

type ProbeAlertDataDTO

type ProbeAlertDataDTO struct {
	PoolRecord      string    `json:"poolRecord"`
	ProbeType       string    `json:"probeType"`
	ProbeStatus     string    `json:"probeStatus"`
	AlertDate       time.Time `json:"alertDate"`
	FailoverOccured bool      `json:"failoverOccured"`
	OwnerName       string    `json:"ownerName"`
	Status          string    `json:"status"`
}

ProbeAlertDataDTO wraps a probe alert response

func (ProbeAlertDataDTO) Equal added in v1.1.0

Equal compares to another ProbeAlertDataDTO, but uses time.Equals to compare semantic equvalance of AlertDate

type ProbeAlertDataListDTO

type ProbeAlertDataListDTO struct {
	Alerts     []ProbeAlertDataDTO `json:"alerts"`
	Queryinfo  QueryInfo           `json:"queryInfo"`
	Resultinfo ResultInfo          `json:"resultInfo"`
}

ProbeAlertDataListDTO wraps the response for an index of probe alerts

type ProbeDetailsDTO

type ProbeDetailsDTO struct {
	Detail interface{} `json:"detail,omitempty"`
	// contains filtered or unexported fields
}

ProbeDetailsDTO wraps the details of a probe

func (*ProbeDetailsDTO) DNSProbeDetails added in v1.2.0

func (s *ProbeDetailsDTO) DNSProbeDetails() (DNSProbeDetailsDTO, error)

DNSProbeDetails returns the ProbeDetailsDTO data deserialized as a DNSProbeDetailsDTO

func (*ProbeDetailsDTO) FTPProbeDetails added in v1.2.0

func (s *ProbeDetailsDTO) FTPProbeDetails() (FTPProbeDetailsDTO, error)

FTPProbeDetails returns the ProbeDetailsDTO data deserialized as a FTPProbeDetailsDTO

func (*ProbeDetailsDTO) GetData

func (s *ProbeDetailsDTO) GetData() []byte

GetData returns the data because I'm working around something.

func (*ProbeDetailsDTO) GetDetailsObject added in v1.2.0

func (s *ProbeDetailsDTO) GetDetailsObject(t ProbeType) (interface{}, error)

GetDetailsObject extracts the appropriate details object from a ProbeDetailsDTO with the given ProbeType

func (*ProbeDetailsDTO) GoString

func (s *ProbeDetailsDTO) GoString() string

GoString returns a string representation of the ProbeDetailsDTO internal data

func (*ProbeDetailsDTO) HTTPProbeDetails added in v1.2.0

func (s *ProbeDetailsDTO) HTTPProbeDetails() (HTTPProbeDetailsDTO, error)

HTTPProbeDetails returns the ProbeDetailsDTO data deserialized as a HTTPProbeDetailsDTO

func (*ProbeDetailsDTO) MarshalJSON

func (s *ProbeDetailsDTO) MarshalJSON() ([]byte, error)

MarshalJSON does what it says on the tin

func (*ProbeDetailsDTO) PingProbeDetails added in v1.2.0

func (s *ProbeDetailsDTO) PingProbeDetails() (PingProbeDetailsDTO, error)

PingProbeDetails returns the ProbeDetailsDTO data deserialized as a PingProbeDetailsDTO

func (*ProbeDetailsDTO) Populate

func (s *ProbeDetailsDTO) Populate(t ProbeType) (err error)

Populate does magical things with json unmarshalling to unroll the Probe into an appropriate datatype. These are helper structures and functions for testing and direct API use. In the Terraform implementation, we will use Terraforms own warped schema structure to handle the marshalling and unmarshalling.

func (*ProbeDetailsDTO) SMTPProbeDetails added in v1.2.0

func (s *ProbeDetailsDTO) SMTPProbeDetails() (SMTPProbeDetailsDTO, error)

SMTPProbeDetails returns the ProbeDetailsDTO data deserialized as a SMTPProbeDetailsDTO

func (*ProbeDetailsDTO) SMTPSENDProbeDetails added in v1.2.0

func (s *ProbeDetailsDTO) SMTPSENDProbeDetails() (SMTPSENDProbeDetailsDTO, error)

SMTPSENDProbeDetails returns the ProbeDetailsDTO data deserialized as a SMTPSENDProbeDetailsDTO

func (*ProbeDetailsDTO) String

func (s *ProbeDetailsDTO) String() string

func (*ProbeDetailsDTO) TCPProbeDetails added in v1.2.0

func (s *ProbeDetailsDTO) TCPProbeDetails() (TCPProbeDetailsDTO, error)

TCPProbeDetails returns the ProbeDetailsDTO data deserialized as a TCPProbeDetails

func (*ProbeDetailsDTO) UnmarshalJSON

func (s *ProbeDetailsDTO) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON does what it says on the tin

type ProbeDetailsLimitDTO

type ProbeDetailsLimitDTO struct {
	Warning  int `json:"warning"`
	Critical int `json:"critical"`
	Fail     int `json:"fail"`
}

ProbeDetailsLimitDTO wraps a probe

type ProbeInfoDTO

type ProbeInfoDTO struct {
	ID         string           `json:"id,omitempty"`
	PoolRecord string           `json:"poolRecord,omitempty"`
	ProbeType  ProbeType        `json:"type"`
	Interval   string           `json:"interval"`
	Agents     []string         `json:"agents"`
	Threshold  int              `json:"threshold"`
	Details    *ProbeDetailsDTO `json:"details"`
}

ProbeInfoDTO wraps a probe response

type ProbeKey

type ProbeKey struct {
	Zone string
	Name string
	ID   string
}

ProbeKey collects the identifiers of a Probe

func (ProbeKey) RRSetKey

func (k ProbeKey) RRSetKey() RRSetKey

RRSetKey generates the RRSetKey for the ProbeKey

func (ProbeKey) URI

func (k ProbeKey) URI() string

URI generates the URI for a probe

type ProbeListDTO

type ProbeListDTO struct {
	Probes     []ProbeInfoDTO `json:"probes"`
	Queryinfo  QueryInfo      `json:"queryInfo"`
	Resultinfo ResultInfo     `json:"resultInfo"`
}

ProbeListDTO wraps a list of probes

type ProbeType added in v1.2.0

type ProbeType string

ProbeType wraps the possible types of a ProbeInfoDTO

const (
	DNSProbeType      ProbeType = "DNS"
	FTPProbeType      ProbeType = "FTP"
	HTTPProbeType     ProbeType = "HTTP"
	PingProbeType     ProbeType = "PING"
	SMTPProbeType     ProbeType = "SMTP"
	SMTPSENDProbeType ProbeType = "SMTP_SEND"
	TCPProbeType      ProbeType = "TCP"
)

Here lie all the possible ProbeType values

type ProbesService

type ProbesService struct {
	// contains filtered or unexported fields
}

ProbesService manages Probes

func (*ProbesService) Create

func (s *ProbesService) Create(k RRSetKey, dp ProbeInfoDTO) (*http.Response, error)

Create creates a probe with a RRSetKey using the ProbeInfoDTO dp

func (*ProbesService) Delete

func (s *ProbesService) Delete(k ProbeKey) (*http.Response, error)

Delete deletes a probe by its ProbeKey

func (*ProbesService) Find

Find returns a probe from a ProbeKey

func (*ProbesService) Select

func (s *ProbesService) Select(k RRSetKey, query string) ([]ProbeInfoDTO, *http.Response, error)

Select returns all probes by a RRSetKey, with an optional query

func (*ProbesService) Update

func (s *ProbesService) Update(k ProbeKey, dp ProbeInfoDTO) (*http.Response, error)

Update updates a probe given a ProbeKey with the ProbeInfoDTO dp

type ProfileSchema

type ProfileSchema string

ProfileSchema are the schema URIs for RRSet Profiles

type QueryInfo

type QueryInfo struct {
	Q       string `json:"q"`
	Sort    string `json:"sort"`
	Reverse bool   `json:"reverse"`
	Limit   int    `json:"limit"`
}

QueryInfo wraps a query request

type RDPoolProfile

type RDPoolProfile struct {
	Context     ProfileSchema `json:"@context"`
	Order       string        `json:"order"`
	Description string        `json:"description"`
}

RDPoolProfile wraps a Profile for a Resource Distribution pool

func (RDPoolProfile) RawProfile

func (p RDPoolProfile) RawProfile() RawProfile

RawProfile converts to a naive RawProfile

type RRSet

type RRSet struct {
	OwnerName string     `json:"ownerName"`
	RRType    string     `json:"rrtype"`
	TTL       int        `json:"ttl"`
	RData     []string   `json:"rdata"`
	Profile   RawProfile `json:"profile,omitempty"`
}

RRSet wraps an RRSet resource

type RRSetKey

type RRSetKey struct {
	Zone string
	Type string
	Name string
}

RRSetKey collects the identifiers of a Zone

func (RRSetKey) AlertsQueryURI

func (k RRSetKey) AlertsQueryURI(offset int) string

AlertsQueryURI generates the alerts query URI for an RRSet with query

func (RRSetKey) AlertsURI

func (k RRSetKey) AlertsURI() string

AlertsURI generates the URI for an RRSet

func (RRSetKey) EventsQueryURI

func (k RRSetKey) EventsQueryURI(query string, offset int) string

EventsQueryURI generates the events query URI for an RRSet with query

func (RRSetKey) EventsURI

func (k RRSetKey) EventsURI() string

EventsURI generates the URI for an RRSet

func (RRSetKey) NotificationsQueryURI

func (k RRSetKey) NotificationsQueryURI(query string, offset int) string

NotificationsQueryURI generates the notifications query URI for an RRSet with query

func (RRSetKey) NotificationsURI

func (k RRSetKey) NotificationsURI() string

NotificationsURI generates the notifications URI for an RRSet

func (RRSetKey) ProbesQueryURI

func (k RRSetKey) ProbesQueryURI(query string) string

ProbesQueryURI generates the probes query URI for an RRSet with query

func (RRSetKey) ProbesURI

func (k RRSetKey) ProbesURI() string

ProbesURI generates the probes URI for an RRSet

func (RRSetKey) QueryURI

func (k RRSetKey) QueryURI(offset int) string

QueryURI generates the query URI for an RRSet and offset

func (RRSetKey) URI

func (k RRSetKey) URI() string

URI generates the URI for an RRSet

type RRSetListDTO

type RRSetListDTO struct {
	ZoneName   string     `json:"zoneName"`
	Rrsets     []RRSet    `json:"rrsets"`
	Queryinfo  QueryInfo  `json:"queryInfo"`
	Resultinfo ResultInfo `json:"resultInfo"`
}

RRSetListDTO wraps a list of RRSet resources

type RRSetsService

type RRSetsService struct {
	// contains filtered or unexported fields
}

RRSetsService provides access to RRSet resources

func (*RRSetsService) Create

func (s *RRSetsService) Create(k RRSetKey, rrset RRSet) (*http.Response, error)

Create creates an rrset with val

func (*RRSetsService) Delete

func (s *RRSetsService) Delete(k RRSetKey) (*http.Response, error)

Delete deletes an RRSet

func (*RRSetsService) Select

func (s *RRSetsService) Select(k RRSetKey) ([]RRSet, error)

Select will list the zone rrsets, paginating through all available results

func (*RRSetsService) SelectWithOffset

func (s *RRSetsService) SelectWithOffset(k RRSetKey, offset int) ([]RRSet, ResultInfo, *http.Response, error)

SelectWithOffset requests zone rrsets by RRSetKey & optional offset

func (*RRSetsService) Update

func (s *RRSetsService) Update(k RRSetKey, val RRSet) (*http.Response, error)

Update updates a RRSet with the provided val

type RawProfile

type RawProfile map[string]interface{}

RawProfile represents the naive interface to an RRSet Profile

func (RawProfile) Context

func (rp RawProfile) Context() ProfileSchema

Context extracts the schema context from a RawProfile

func (RawProfile) DirPoolProfile

func (rp RawProfile) DirPoolProfile() (DirPoolProfile, error)

DirPoolProfile extracts the full Profile as a DirPoolProfile or returns an error

func (RawProfile) GetProfileObject

func (rp RawProfile) GetProfileObject() (interface{}, error)

GetProfileObject extracts the full Profile by its schema type

func (RawProfile) RDPoolProfile

func (rp RawProfile) RDPoolProfile() (RDPoolProfile, error)

RDPoolProfile extracts the full Profile as a RDPoolProfile or returns an error

func (RawProfile) SBPoolProfile

func (rp RawProfile) SBPoolProfile() (SBPoolProfile, error)

SBPoolProfile extracts the full Profile as a SBPoolProfile or returns an error

func (RawProfile) TCPoolProfile

func (rp RawProfile) TCPoolProfile() (TCPoolProfile, error)

TCPoolProfile extracts the full Profile as a TCPoolProfile or returns an error

type ResultInfo

type ResultInfo struct {
	TotalCount    int `json:"totalCount"`
	Offset        int `json:"offset"`
	ReturnedCount int `json:"returnedCount"`
}

ResultInfo wraps the list metadata for an index response

type SBPoolProfile

type SBPoolProfile struct {
	Context       ProfileSchema  `json:"@context"`
	Description   string         `json:"description"`
	RunProbes     bool           `json:"runProbes"`
	ActOnProbes   bool           `json:"actOnProbes"`
	Order         string         `json:"order,omitempty"`
	MaxActive     int            `json:"maxActive,omitempty"`
	MaxServed     int            `json:"maxServed,omitempty"`
	RDataInfo     []SBRDataInfo  `json:"rdataInfo"`
	BackupRecords []BackupRecord `json:"backupRecords"`
}

SBPoolProfile wraps a Profile for a SiteBacker pool

func (SBPoolProfile) RawProfile

func (p SBPoolProfile) RawProfile() RawProfile

RawProfile converts to a naive RawProfile

type SBRDataInfo

type SBRDataInfo struct {
	State            string `json:"state"`
	RunProbes        bool   `json:"runProbes"`
	Priority         int    `json:"priority"`
	FailoverDelay    int    `json:"failoverDelay,omitempty"`
	Threshold        int    `json:"threshold"`
	Weight           int    `json:"weight"`
	AvailableToServe bool   `json:"availableToServe,omitempty"`
}

SBRDataInfo wraps the rdataInfo object of a SBPoolProfile

type SMTPProbeDetailsDTO

type SMTPProbeDetailsDTO struct {
	Port   int                             `json:"port,omitempty"`
	Limits map[string]ProbeDetailsLimitDTO `json:"limits"`
}

SMTPProbeDetailsDTO wraps SMTP probe details

type SMTPSENDProbeDetailsDTO

type SMTPSENDProbeDetailsDTO struct {
	Port    int                             `json:"port,omitempty"`
	From    string                          `json:"from"`
	To      string                          `json:"to"`
	Message string                          `json:"message,omitempty"`
	Limits  map[string]ProbeDetailsLimitDTO `json:"limits"`
}

SMTPSENDProbeDetailsDTO wraps SMTP SEND probe details

type TCPProbeDetailsDTO

type TCPProbeDetailsDTO struct {
	Port      int                             `json:"port,omitempty"`
	ControlIP string                          `json:"controlIP,omitempty"`
	Limits    map[string]ProbeDetailsLimitDTO `json:"limits"`
}

TCPProbeDetailsDTO wraps TCP probe details

type TCPoolProfile

type TCPoolProfile struct {
	Context      ProfileSchema `json:"@context"`
	Description  string        `json:"description"`
	RunProbes    bool          `json:"runProbes"`
	ActOnProbes  bool          `json:"actOnProbes"`
	MaxToLB      int           `json:"maxToLB,omitempty"`
	RDataInfo    []SBRDataInfo `json:"rdataInfo"`
	BackupRecord *BackupRecord `json:"backupRecord,omitempty"`
	Status       string        `json:"status,omitempty"`
}

TCPoolProfile wraps a Profile for a Traffic Controller pool

func (TCPoolProfile) RawProfile

func (p TCPoolProfile) RawProfile() RawProfile

RawProfile converts to a naive RawProfile

type Task

type Task struct {
	TaskID         string `json:"taskId"`
	TaskStatusCode string `json:"taskStatusCode"`
	Message        string `json:"message"`
	ResultURI      string `json:"resultUri"`
}

Task wraps a task response

type TaskID

type TaskID string

TaskID represents the string identifier of a task

func (TaskID) ResultURI

func (t TaskID) ResultURI() string

ResultURI generates URI for the task result

func (TaskID) URI

func (t TaskID) URI() string

URI generates the URI for a task

type TaskListDTO

type TaskListDTO struct {
	Tasks      []Task     `json:"tasks"`
	Queryinfo  QueryInfo  `json:"queryInfo"`
	Resultinfo ResultInfo `json:"resultInfo"`
}

TaskListDTO wraps a list of Task resources, from an HTTP response

type TasksService

type TasksService struct {
	// contains filtered or unexported fields
}

TasksService provides access to the tasks resources

func (*TasksService) Delete

func (s *TasksService) Delete(t TaskID) (*http.Response, error)

Delete requests deletions

func (*TasksService) Find

func (s *TasksService) Find(t TaskID) (Task, *http.Response, error)

Find Get the status of a task.

func (*TasksService) FindResult

func (s *TasksService) FindResult(t TaskID) (*http.Response, error)

FindResult requests

func (*TasksService) FindResultByTask

func (s *TasksService) FindResultByTask(t Task) (*http.Response, error)

FindResultByTask requests a task by the provided task's result uri

func (*TasksService) Select

func (s *TasksService) Select(query string) ([]Task, error)

Select requests all tasks, with pagination

func (*TasksService) SelectWithOffset

func (s *TasksService) SelectWithOffset(query string, offset int) ([]Task, ResultInfo, *http.Response, error)

SelectWithOffset request tasks by query & offset, list them also returning list metadata, the actual response, or an error

type Transaction

type Transaction struct {
	Method          string                          `json:"method"`
	URL             string                          `json:"url"`
	TransmittedData string                          `json:"transmittedData,omitempty"`
	FollowRedirects bool                            `json:"followRedirects,omitempty"`
	Limits          map[string]ProbeDetailsLimitDTO `json:"limits"`
}

Transaction wraps a transaction response

Directories

Path Synopsis
cmd
Package password implements the OAuth2.0 "password credentials" token flow.
Package password implements the OAuth2.0 "password credentials" token flow.

Jump to

Keyboard shortcuts

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