Giter VIP home page Giter VIP logo

ultradns-go's Introduction

ultradns-go

Provides an UltraDNS API package called ultradns for go

Usage

Import:

import "github.com/simplifi/ultradns-go"

To do a basic API connection and call, construct an ultradns.APIConnection struct. ultradns.NewAPIConnection() is provided to apply default configuration while still allowing control over the underlying connection.

When creating the struct either via the NewAPIConnection() call, or directly, either the Username/Password or RefreshToken must be set. If you pass both, the RefreshToken takes precedence.

This project only supports the JSON API request/response for UltraDNS, not the optional XML format.

apiConn := ultradns.NewAPIConnection(&ultradns.APIOptions{
  // API Username.
  Username: "",

  // API Password. 
  Password: "",

  // This refresh token can be used in lieu of username/password. To initially get a RefreshToken requires a
  // Username/Password, however.
  RefreshToken: "",

  // Defaults to "https://api.ultradns.com". Typically only overridden to allow testing or to use a sandbox endpoint.
  BaseURL: "https://api.ultradns.com",

  // Timeout is a time.Duration given to the underlying http.Client
  Timeout: 5 * time.Second,
})

// apiConn has a similar API to go's net/http library

// Send a GET request to the given path. Returns a http.Response pointer and error.
resp, err := apiConn.Get("/some/api/path")

// Send a POST request to the given path. Returns a http.Response pointer and error.
resp, err := apiConn.Post("/some/api/path", json_to_send)

Examples

There are various examples in examples/ that give real examples. Most require passing in a -user and -pass flag to authenticate with UltraDNS. To build an example, run make <name of example>

For example, to compile and run the status example from examples/status/main.go:

make status
./status -user <username> -pass <password>

Testing

Ensure that golint is installed

go get -u golang.org/x/lint/golint

Run all tests, linters, etc with make.

ultradns-go's People

Contributors

joshuawscott avatar

Watchers

 avatar Marlon Moyer avatar Justin Edwards avatar James Cloos avatar John Graham avatar  avatar Mike Berrow avatar Kurt Johnson avatar Michael Mooney avatar Daniel Gale avatar John Twombly avatar Kyle Hogue avatar Sammie Elkurd avatar Joe Hughes avatar

Forkers

isabella232

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.