hcloud-go

module
v1.33.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2022 License: MIT

README

hcloud: A Go library for the Hetzner Cloud API

GitHub Actions status GoDoc

Package hcloud is a library for the Hetzner Cloud API.

The library’s documentation is available at GoDoc, the public API documentation is available at docs.hetzner.cloud.

Example

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/hetznercloud/hcloud-go/hcloud"
)

func main() {
    client := hcloud.NewClient(hcloud.WithToken("token"))

    server, _, err := client.Server.GetByID(context.Background(), 1)
    if err != nil {
        log.Fatalf("error retrieving server: %s\n", err)
    }
    if server != nil {
        fmt.Printf("server 1 is called %q\n", server.Name)
    } else {
        fmt.Println("server 1 not found")
    }
}

License

MIT license

Directories

Path Synopsis
Package hcloud is a library for the Hetzner Cloud API.
Package hcloud is a library for the Hetzner Cloud API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL