client

package
v0.0.0-...-58d3d42 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2018 License: MIT Imports: 8 Imported by: 72

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Key is the API key to provide to gandi
	Key string
	// Url is the base URL of the gandi API
	Url string
}

Client holds the configuration of a gandi client

func New

func New(apiKey string, system SystemType) *Client

New creates a new gandi client for the given system

func (*Client) Call

func (c *Client) Call(serviceMethod string, args []interface{}, reply interface{}) error

Call performs an acual XML RPC call to the gandi API

func (*Client) Delete

func (c *Client) Delete(URI string, decoded interface{}) (*http.Response, error)

Delete performs a Delete request to gandi Live DNS api and decodes the returned data if a not null decoded pointer is provided

func (*Client) DoRest

func (c *Client) DoRest(req *http.Request, decoded interface{}) (*http.Response, error)

DoRest performs a request to gandi LiveDNS api and optionnally decodes the reply

func (*Client) Get

func (c *Client) Get(URI string, decoded interface{}) (*http.Response, error)

Get performs a Get request to gandi Live DNS api and decodes the returned data if a not null decoded pointer is provided

func (*Client) NewJSONRequest

func (c *Client) NewJSONRequest(method string, url string, data interface{}) (*http.Request, error)

NewJSONRequest creates a new authenticated to gandi live DNS REST API. If data is not null, it will be encoded as json and prodived in the request body

func (*Client) Patch

func (c *Client) Patch(URI string, data interface{}, decoded interface{}) (*http.Response, error)

Patch performs a Patch request to gandi Live DNS api - with data encoded as JSON if a not null data pointer is provided - decodes the returned data if a not null decoded pointer is provided - ensures the status code is an HTTP accepted

func (*Client) Post

func (c *Client) Post(URI string, data interface{}, decoded interface{}) (*http.Response, error)

Post performs a Post request request to gandi Live DNS api - with data encoded as JSON if a not null data pointer is provided - decodes the returned data if a not null decoded pointer is provided - ensures the status code is an HTTP accepted

func (*Client) Put

func (c *Client) Put(URI string, data interface{}, decoded interface{}) (*http.Response, error)

Put performs a Put request to gandi Live DNS api - with data encoded as JSON if a not null data pointer is provided - decodes the returned data if a not null decoded pointer is provided

type SystemType

type SystemType int

SystemType is the type used to resolve gandi API address

const (
	// Production is the SystemType to provide to New to use the production XML API
	Production SystemType = iota
	// Testing is the SystemType to provide to New to use the test XML API
	Testing
	// LiveDNS is the SystemType to provide to New to use the Live DNS REST API
	// Full documentation of the API is available here: http://doc.livedns.gandi.net/
	LiveDNS
)

func (SystemType) Url

func (s SystemType) Url() string

Url returns the actual gandi API base URL

Jump to

Keyboard shortcuts

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