client

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// WapiVersion is the running WAPI version on infoblox.
	WapiVersion = "2.7.3"
	// BaseURI is the base uri for the WAPI.
	BaseURI = "/wapi/v" + WapiVersion + "/"
)

Functions

func DecodeIO

func DecodeIO(io io.Reader, model interface{}) (err error)

DecodeIO decodes io.Reader objects and maps the result to a pointer.

func FromFile

func FromFile(path string) (r []byte, err error)

FromFile returns the contents of a file.

func FromJSONFile

func FromJSONFile(path string, ob interface{}) (err error)

FromJSONFile converts a file object to a pointer.

func GetMD5Hash

func GetMD5Hash(text string) string

GetMD5Hash returns the MD5 Hash of a string.

func MapInterface

func MapInterface(i interface{}) (r map[string]interface{}, err error)

MapInterface creates a map of an interface's top level keys. Values are represented as type interface and can be converted. to string using fmt.Sprint.

func MarshalInterface

func MarshalInterface(in interface{}, out interface{}) (err error)

MarshalInterface converts a generic interface to a pointer.

func OrderUnique

func OrderUnique(in []string) ([]string, error)

OrderUnique sorts unique keys within a string array.

func ToJSON

func ToJSON(p interface{}) string

ToJSON converts interface to string.

func ToPrettyJSON

func ToPrettyJSON(p interface{}) []byte

ToPrettyJSON converts interface to bytes.

Types

type Client

type Client struct {
	Host   Host
	Prefix string
	Cookie *http.Cookie
}

Client struct.

func NewClient

func NewClient(target string, userName string, password string) (r *Client, err error)

NewClient establishes new REST session.

func (*Client) Delete

func (c *Client) Delete(uri string, response interface{}) error

Delete request with applicable interface.

func (*Client) Get

func (c *Client) Get(uri string, response interface{}) error

Get request with applicable interface.

func (*Client) LogOut

func (c *Client) LogOut() (err error)

LogOut kills session.

func (*Client) Post

func (c *Client) Post(uri string, payload interface{}, response interface{}) error

Post request with applicable interface.

func (*Client) Put

func (c *Client) Put(uri string, payload interface{}, response interface{}) error

Put request with applicable interface.

type Host

type Host struct {
	Name     string
	UserName string
	Password string
}

type Login

type Login struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

Login struct.

type Network

type Network struct {
	Client *Client
	Filter string
}

Network stores all methods and objects related to network.

func (Network) Fetch

func (o Network) Fetch() (r model.NetworkResponseWrapper, err error)

Fetch returns all A records.

func (Network) FetchByNetwork

func (o Network) FetchByNetwork(network string) (r model.NetworkResponseWrapper, err error)

FetchByNetwork returns a network based on network.

func (Network) FetchByRef

func (o Network) FetchByRef(ref string) (r model.NetworkResponse, err error)

FetchByRef returns a network based on reference.

func (Network) FetchNextAvailableIP

func (o Network) FetchNextAvailableIP(ref string, count int) (r model.NextAvailable, err error)

FetchNextAvailableIP returns next available ips.

type Range

type Range struct {
	Client *Client
	Filter string
}

Range stores all methods and objects related to range.

func (Range) Fetch

func (o Range) Fetch() (r model.RangeResponseWrapper, err error)

Fetch returns all A records.

func (Range) FetchByRange

func (o Range) FetchByRange(start string) (r model.RangeResponseWrapper, err error)

FetchByRange returns a range based on range.

func (Range) FetchByRef

func (o Range) FetchByRef(ref string) (r model.RangeResponse, err error)

FetchByRef returns a range based on reference.

func (Range) FetchNextAvailableIP

func (o Range) FetchNextAvailableIP(ref string, count int) (r model.NextAvailable, err error)

FetchNextAvailableIP returns next available ips.

type RecordA

type RecordA struct {
	Client *Client
	Filter string
}

RecordA stores all methods and objects related to record:a.

func (RecordA) Create

func (o RecordA) Create(req model.RecordACreateRequest) (r string, err error)

Create creates a record:a resource in infoblox and returns its reference.

func (RecordA) Delete

func (o RecordA) Delete(ref string) (r string, err error)

Delete will delete a record:a resource in infoblox and return its previous reference. WARNING! This will delete the resource without warning.

func (RecordA) Fetch

func (o RecordA) Fetch() (r model.RecordAResponseWrapper, err error)

Fetch returns all A records.

func (RecordA) FetchByIP

func (o RecordA) FetchByIP(ip string) (r model.RecordAResponseWrapper, err error)

FetchByIP returns a record:a based on ip address.

func (RecordA) FetchByName

func (o RecordA) FetchByName(name string) (r model.RecordAResponseWrapper, err error)

FetchByName returns a record:a based on name.

func (RecordA) FetchByRef

func (o RecordA) FetchByRef(ref string) (r model.RecordAResponse, err error)

FetchByRef returns a record:a based on reference.

func (RecordA) Modify

func (o RecordA) Modify(ref string, req model.RecordAUpdateRequest) (r string, err error)

Modify updates a record:a resource in infoblox and returns its reference. This action can potentially change the object reference.

type RecordCname

type RecordCname struct {
	Client *Client
	Filter string
}

RecordCname stores all methods and objects related to record:cname.

func (RecordCname) Create

func (o RecordCname) Create(req model.RecordCnameCreateRequest) (r string, err error)

Create creates a record:cname resource in infoblox and returns its reference.

func (RecordCname) Delete

func (o RecordCname) Delete(ref string) (r string, err error)

Delete will delete a record:cname resource in infoblox and return its previous reference.

func (RecordCname) Fetch

func (RecordCname) FetchByCanonical

func (o RecordCname) FetchByCanonical(canonical string) (r model.RecordCnameResponseWrapper, err error)

FetchByCanonical returns a record:cname based on canonical.

func (RecordCname) FetchByName

func (o RecordCname) FetchByName(name string) (r model.RecordCnameResponseWrapper, err error)

FetchByName returns a record:cname based on name.

func (RecordCname) FetchByRef

func (o RecordCname) FetchByRef(ref string) (r model.RecordCnameResponse, err error)

FetchByRef returns a record:cname based on reference.

func (RecordCname) Modify

func (o RecordCname) Modify(ref string, req model.RecordCnameUpdateRequest) (r string, err error)

Modify updates a record:cname resource in infoblox and returns its reference. This action can potentially change the object reference.

type RecordHost

type RecordHost struct {
	Client *Client
	Filter string
}

RecordHost stores all methods and objects related to record:host.

func (RecordHost) Create

func (o RecordHost) Create(req model.RecordHostCreateRequest) (r string, err error)

Create creates a record:host resource in infoblox and returns its reference.

func (RecordHost) Delete

func (o RecordHost) Delete(ref string) (r string, err error)

Delete will delete a record:host resource in infoblox and return its previous reference.

func (RecordHost) Fetch

func (o RecordHost) Fetch() (r model.RecordHostResponseWrapper, err error)

Fetch returns all host records.

func (RecordHost) FetchByIPAddress

func (o RecordHost) FetchByIPAddress(ip string) (r model.RecordHostResponseWrapper, err error)

FetchByIPAddress returns a record:a based on ip address.

func (RecordHost) FetchByName

func (o RecordHost) FetchByName(name string) (r model.RecordHostResponseWrapper, err error)

FetchByName returns a record:host based on name.

func (RecordHost) FetchByRef

func (o RecordHost) FetchByRef(ref string) (r model.RecordHostResponse, err error)

FetchByRef returns a record:host based on reference.

func (RecordHost) Modify

func (o RecordHost) Modify(ref string, req model.RecordHostUpdateRequest) (r string, err error)

Modify updates a record:host resource in infoblox and returns its reference. This action can potentially change the object reference.

type RecordPTR

type RecordPTR struct {
	Client *Client
	Filter string
}

RecordPTR stores all methods and objects related to record:ptr.

func (RecordPTR) Create

func (o RecordPTR) Create(req model.RecordPTRCreateRequest) (r string, err error)

Create creates a record:ptr resource in infoblox and returns its reference.

func (RecordPTR) Delete

func (o RecordPTR) Delete(ref string) (r string, err error)

Delete will delete a record:ptr resource in infoblox and return its previous reference. WARNING! This will delete the resource without warning.

func (RecordPTR) Fetch

func (o RecordPTR) Fetch() (r model.RecordPTRResponseWrapper, err error)

Fetch returns all PTR records.

func (RecordPTR) FetchByIP

func (o RecordPTR) FetchByIP(ip string) (r model.RecordPTRResponseWrapper, err error)

FetchByIP returns a record:ptr based on ip address.

func (RecordPTR) FetchByName

func (o RecordPTR) FetchByName(name string) (r model.RecordPTRResponseWrapper, err error)

FetchByName returns a record:ptr based on name.

func (RecordPTR) FetchByRef

func (o RecordPTR) FetchByRef(ref string) (r model.RecordPTRResponse, err error)

FetchByRef returns a record:ptr based on reference.

func (RecordPTR) Modify

func (o RecordPTR) Modify(ref string, req model.RecordPTRUpdateRequest) (r string, err error)

Modify updates a record:ptr resource in infoblox and returns its reference. This action can potentially change the object reference.

Jump to

Keyboard shortcuts

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