types

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: MIT Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Panic

func Panic(e Error)

Panic wraps a panic call propagating the given error parameter

func PanicIfError

func PanicIfError(e error)

PanicIfError is just a wrapper to a panic call that propagates error when it's not nil

Types

type DNSManager

type DNSManager interface {

	// GetDNSRecords retrieves all the dns records being managed
	GetDNSRecords() ([]DNSRecord, error)

	// GetDNSRecord retrieves the dns record identified by name
	GetDNSRecord(name, recordType string) (*DNSRecord, error)

	// RemoveDNSRecord removes a DNS record
	RemoveDNSRecord(name, recordType string) error

	// AddDNSRecord adds a new DNS record
	AddDNSRecord(record DNSRecord) error

	// UpdateDNSRecord updates an existing DNS record
	UpdateDNSRecord(record DNSRecord) error
}

DNSManager defines the operations a DNS Manager provider should implement

type DNSRecord

type DNSRecord struct {
	// Name the DNS host name
	Name string `json:"name"`

	// Value the value of this record
	Value string `json:"value"`

	// Type the record type
	Type string `json:"type"`
}

DNSRecord defines what we understand as a DNSRecord

func (*DNSRecord) Check

func (record *DNSRecord) Check() []string

Check verifies if the DNS record satisfies certain conditions

type Error

type Error struct {
	Message string   `json:"message"`
	Code    int      `json:"code"`
	Details []string `json:"details,omitempty"`
	Err     error    `json:"-"`
}

Error groups together information that defines an error. Should always be used to

func BadRequestError

func BadRequestError(message string, err error, details ...string) *Error

BadRequestError create an Error instance with http.StatusBadRequest code

func InternalServerError

func InternalServerError(message string, err error, details ...string) *Error

BadRequestError create an Error instance with http.StatusInternalServerError code

func NotFoundError

func NotFoundError(message string, err error, details ...string) *Error

BadRequestError create an Error instance with http.StatusNotFound code

func (*Error) Error

func (e *Error) Error() string

Error() gives a string representing the error; also, forces the Error type to comply with the error interface

Jump to

Keyboard shortcuts

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