https://github.com/ppmathis/cloudns-go
Unofficial ClouDNS API Client compatible with Go 1.13+
https://github.com/ppmathis/cloudns-go
Last synced: about 1 year ago
JSON representation
Unofficial ClouDNS API Client compatible with Go 1.13+
- Host: GitHub
- URL: https://github.com/ppmathis/cloudns-go
- Owner: ppmathis
- License: mit
- Created: 2019-12-26T01:15:41.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-03-04T11:12:27.000Z (over 3 years ago)
- Last Synced: 2025-03-26T13:45:42.047Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 84 KB
- Stars: 4
- Watchers: 4
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# cloudns-go
[](https://github.com/ppmathis/cloudns-go/LICENSE.txt)
[](https://godoc.org/github.com/ppmathis/cloudns-go)
[](#)
[](https://github.com/ppmathis/cloudns-go/issues)
[](https://codecov.io/gh/ppmathis/cloudns-go)
[](#)
## Summary
This is an unofficial library for the ClouDNS HTTP API written in Go. Currently all operations related to account,
zone and record management have been fully implemented. Further information about the API can be found at the
[official ClouDNS website](https://www.cloudns.net/).
## Quick Start
Initialize cloudns-go by creating a new API client instance with your preferred choice of credentials, which is a
combination of the API user password and an user ID, sub-user ID or sub-user name:
```go
client, err := cloudns.New(
// You must only specify one of these options
// AuthUserID has the highest set of privileges and access to everything
// AuthSubUserID and AuthSubUserName are restricted
cloudns.AuthUserID(42, "cloudns-rocks"),
cloudns.AuthSubUserID(13, "what-a-lucky-day"),
cloudns.AuthSubUserName("john", "doe"),
)
```
After confirming that no error has occurred, you may access the various services available underneath the client object,
which currently consists of:
- `client.Accounts`: Manage your ClouDNS account and sub-users
- `client.Zones`: Manage DNS zones in your account
- `client.Records`: Manage records inside a specific DNS zone
You can find more information about the specific methods and structures of cloudns-go by visiting the
[official documentation on godoc.org](https://godoc.org/github.com/ppmathis/cloudns-go).
## Example
```go
package main
import (
"context"
"fmt"
"github.com/ppmathis/cloudns-go"
)
func main() {
client, _ := cloudns.New(
cloudns.AuthUserID(42, "cloudns-rocks"),
)
zone, _ := client.Zones.Get(context.TODO(), "api-example.com")
result1, _ := client.Zones.SetActive(context.TODO(), zone.Name, true)
record := cloudns.NewRecord(cloudns.RecordTypeA, "localhost", "1.2.3.4", 3600)
result2, _ := client.Records.Create(context.TODO(), zone.Name, record)
fmt.Printf("Zone: %+v\n", zone)
fmt.Printf("Record: %+v\n", record)
fmt.Printf("Result of `Zones.SetActive()`: %+v\n", result1)
fmt.Printf("Result of `Records.Create()`: %+v\n", result2)
}
```