Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
.github/workflows/ | H | 23-Aug-2021 | - | |||
hcloud/ | H | 23-Aug-2021 | - | |||
script/ | H | 23-Aug-2021 | - | |||
.gitignore | H A D | 23-Aug-2021 | 6 | |||
.gitlab-ci.yml | H A D | 23-Aug-2021 | 386 | |||
.golangci.yaml | H A D | 23-Aug-2021 | 1.3 KiB | |||
.goreleaser.yml | H A D | 23-Aug-2021 | 104 | |||
CHANGES.md | H A D | 23-Aug-2021 | 4.2 KiB | |||
LICENSE | H A D | 23-Aug-2021 | 1.1 KiB | |||
README.md | H A D | 23-Aug-2021 | 1.1 KiB | |||
go.mod | H A D | 23-Aug-2021 | 833 | |||
go.sum | H A D | 23-Aug-2021 | 14 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