Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/panta/go-hetzner-dns
Use Hetzner DNS API from Golang.
https://github.com/panta/go-hetzner-dns
Last synced: about 23 hours ago
JSON representation
Use Hetzner DNS API from Golang.
- Host: GitHub
- URL: https://github.com/panta/go-hetzner-dns
- Owner: panta
- Created: 2021-01-28T18:14:02.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-17T12:22:11.000Z (almost 4 years ago)
- Last Synced: 2024-11-05T12:24:01.242Z (about 2 months ago)
- Language: Go
- Size: 20.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-2.0.txt
Awesome Lists containing this project
README
README
======Use [Hetzner DNS API](https://dns.hetzner.com/api-docs/) from [Golang](https://golang.org/).
## Install
```console
go get github.com/panta/go-hetzner-dns
```## Usage
### Authentication
Hetzner DNS API uses an API token. You can either explicitly set the
token in the `ApiKey` field of the `Client` object, or you can set the
environment variable `HETZNER_API_KEY`.### API
Almost all Hetzner DNS APIs are supported. See the example in `cmd/example` or
the tests in `hetzner_dns_test.go` for a more complete list.```go
import "github.com/panta/go-hetzner-dns"client := hetzner_dns.Client{}
// ...
zonesResponse, err := client.GetZones(context.Background(), "", "", 1, 100)
if err != nil {
log.Fatal(err)
}// ...
recordsResponse, err := client.GetRecords(context.Background(), "zone-id", 0, 0)
if err != nil {
log.Fatal(err)
}
```### Overriding the http.Client
It's possible to use a custom `http.Client` object by setting the
`HttpClient` field in the `Client` object. If not set, the library
will create one for you.### Example program
To build the example program on a unix-like:
```shell
$ make
```then:
```shell
$ export HETZNER_API_KEY="....."
$ ./go-hetzner-dns list
$ ./go-hetzner-dns add-record -zone=ZONEID RECORD_NAME TYPE RECORD_VALUE
$ ./go-hetzner-dns update-record -zone=ZONEID RECORD_NAME TYPE RECORD_VALUE
```## Author
By [Marco Pantaleoni](https://github.com/panta).
## LICENSE
```
Copyright 2021 Marco Pantaleoni.Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```