• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/workflows/H23-Aug-2021-

hcloud/H23-Aug-2021-

script/H23-Aug-2021-

.gitignoreH A D23-Aug-20216

.gitlab-ci.ymlH A D23-Aug-2021386

.golangci.yamlH A D23-Aug-20211.3 KiB

.goreleaser.ymlH A D23-Aug-2021104

CHANGES.mdH A D23-Aug-20214.2 KiB

LICENSEH A D23-Aug-20211.1 KiB

README.mdH A D23-Aug-20211.1 KiB

go.modH A D23-Aug-2021833

go.sumH A D23-Aug-202114 KiB

README.md

1# hcloud: A Go library for the Hetzner Cloud API
2
3[![GitHub Actions status](https://github.com/hetznercloud/hcloud-go/workflows/Continuous%20Integration/badge.svg)](https://github.com/hetznercloud/hcloud-go/actions)
4[![GoDoc](https://godoc.org/github.com/hetznercloud/hcloud-go/hcloud?status.svg)](https://godoc.org/github.com/hetznercloud/hcloud-go/hcloud)
5
6Package hcloud is a library for the Hetzner Cloud API.
7
8The library’s documentation is available at [GoDoc](https://godoc.org/github.com/hetznercloud/hcloud-go/hcloud),
9the public API documentation is available at [docs.hetzner.cloud](https://docs.hetzner.cloud/).
10
11## Example
12
13```go
14package main
15
16import (
17    "context"
18    "fmt"
19    "log"
20
21    "github.com/hetznercloud/hcloud-go/hcloud"
22)
23
24func main() {
25    client := hcloud.NewClient(hcloud.WithToken("token"))
26
27    server, _, err := client.Server.GetByID(context.Background(), 1)
28    if err != nil {
29        log.Fatalf("error retrieving server: %s\n", err)
30    }
31    if server != nil {
32        fmt.Printf("server 1 is called %q\n", server.Name)
33    } else {
34        fmt.Println("server 1 not found")
35    }
36}
37```
38
39## License
40
41MIT license
42