Skip to content
/ gcore Public

libdns package for the GCore managed DNS service

License

Notifications You must be signed in to change notification settings

libdns/gcore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GCore for libdns

Go Reference

This package implements the libdns interfaces for GCore, allowing you to manage DNS records.

Authenticating

To authenticate you need to supply a GCore API Key.

Example

Here's a minimal example of how to get all DNS records for zone.

// Package main provides a simple example of how to use the libdns-gcore package.
package main

import (
    "context"
    "fmt"
    "os"
    "path/filepath"

    gcore "github.com/libdns/gcore"
)

func main() {
    apiKey := os.Getenv("GCORE_API_KEY")
    if apiKey == "" {
        fmt.Printf("GCORE_API_KEY not set\n")
        return
    }

    if len(os.Args) < 2 {
        fmt.Printf("Usage: %s <zone>\n", filepath.Base(os.Args[0]))
        os.Exit(1)
    }

    zone := os.Args[1]

    provider := &gcore.Provider{
        APIKey: apiKey,
    }

    records, err := provider.GetRecords(context.Background(), zone)
    if err != nil {
        fmt.Printf("Error: %s", err.Error())
        return
    }

    fmt.Println(records)
}

About

libdns package for the GCore managed DNS service

Resources

License

Stars

Watchers

Forks

Languages