🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

github.com/leganck/dnspod-go

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/leganck/dnspod-go

Source
Go
Version
v0.4.1
Version published
Created
Source

DNSPod Go API client

Build Status PkgGoDev Go Report Card

A Go client for the DNSPod API.

Originally inspired by dnsimple

DNSPod is now a part of Tencent Cloud.

We recommend using https://github.com/tencentcloud/tencentcloud-sdk-go

https://github.com/TencentCloud/tencentcloud-sdk-go/tree/master/tencentcloud/dnspod

Getting Started

This library is a Go client you can use to interact with the DNSPod API.

package main

import (
	"fmt"
	"log"

	"github.com/nrdcg/dnspod-go"
)

func main() {
	apiToken := "xxxxx"

	params := dnspod.CommonParams{LoginToken: apiToken, Format: "json"}
	client := dnspod.NewClient(params)

	// Get a list of your domains
	domains, _, _ := client.Domains.List()
	for _, domain := range domains {
		fmt.Printf("Domain: %s (id: %s)\n", domain.Name, domain.ID)
	}

	// Get a list of your domains (with error management)
	domains, _, err := client.Domains.List()
	if err != nil {
		log.Fatalln(err)
	}
	for _, domain := range domains {
		fmt.Printf("Domain: %s (id: %s)\n", domain.Name, domain.ID)
	}

	// Create a new Domain
	newDomain := dnspod.Domain{Name: "example.com"}
	domain, _, _ := client.Domains.Create(newDomain)
	fmt.Printf("Domain: %s\n (id: %s)", domain.Name, domain.ID)
}

API documentation

License

This is Free Software distributed under the MIT license.

FAQs

Package last updated on 01 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts