Skip to content

Latest commit

 

History

633 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status GoDoc

NS1 Golang SDK

This project is in active development.

The golang client for the NS1 API: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Introduction

The documentation can be found here: https://pkg.go.dev/gopkg.in/ns1/ns1-go.v2

Installing

$ go get gopkg.in/ns1/ns1-go.v2

Examples

See more

package main

import (
	"fmt"
	"log"
	"net/http"
	"os"
	"time"

	api "gopkg.in/ns1/ns1-go.v2/rest"
)

func main() {
	k := os.Getenv("NS1_APIKEY")
	if k == "" {
		fmt.Println("NS1_APIKEY environment variable is not set, giving up")
		os.Exit(1)
	}

	httpClient := &http.Client{Timeout: time.Second * 10}
	client := api.NewClient(httpClient, api.SetAPIKey(k))

	zones, _, err := client.Zones.List()
	if err != nil {
		log.Fatal(err)
	}

	for _, z := range zones {
		fmt.Println(z.Zone)
	}

}

Contributing

Pull Requests and issues are welcome. See the NS1 Contribution Guidelines for more information.

Run tests:

make test

Local dev: use the go.mod replace directive or go work use in client code to point to the local checkout of this repository.

Consider running ./script/install-git-hooks to install local git hooks for this project.

LICENSE

Apache2 - see the included LICENSE file for more information

About

Golang API client for NS1

Resources

Stars

36 stars

Watchers

24 watching

Forks

Releases

Packages

Used by

Contributors

Languages