Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

libdns/alidns

Open more actions menu

Repository files navigation

AliDNS for libdns

Go Reference

This package implements the libdns interfaces, allowing you to manage DNS records with the AliDNS API ( which has a nice Go SDK implementation here )

The metadata of AliDNS API here.

The document of request and signing processing are v2 and v3 (Current schema version is already v3, v2 will be archived. ).

Authenticating

To authenticate you need to supply our AccessKeyID and AccessKeySecret or SecurityToken to the Provider.

To authenticate with role permission you should allow following actions to use this normally.

DescribeDomains // this action is detecting your domain related alidns instance editon for completing the minimum TTL (600 for free edition,others is zero)
AddDomainRecord
DeleteDomainRecord
UpdateDomainRecord
DescribeDomainRecords

Example

Here's a minimal example of how to get all your DNS records using this libdns provider

package main

import (
        "context"
        "fmt"
        "github.com/libdns/alidns"
)

func main() {
        provider := alidns.Provider{
               AccessKeyID: "<AccessKeyId form your aliyun console>",
               AccessKeySecret: "<AccessKeySecret form your aliyun console>",
        }

        records, err  := provider.GetRecords(context.TODO(), "example.com")
        if err != nil {
                fmt.Println(err.Error())
        }

        for _, record := range records {
                tmp := record.RR()
                fmt.Printf("%s %v %s %s\n", tmp.Name, tmp.TTL.Seconds(), tmp.Type, tmp.Value)
        }
}

For complete demo check _demo/demo.go

About

Alibaba Cloud DNS (AliDNS) provider for libdns

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.