Skip to content

selectel/dedicated-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dedicated-go

Go SDK for Selectel Dedicated Servers

Getting started

Installation

You can install needed dedicated-go packages via go get command:

go get github.com/selectel/dedicated-go

Authentication

To work with the Selectel Dedicated Servers API you first need to:

Endpoints

You can find available endpoints here.

Usage example

package main

import (
	"context"
	"fmt"
	"log"

	dedicated "github.com/selectel/dedicated-go/pkg/v2"
)

func main() {
	// Auth token.
	token := "gAAAAABeVNzu-..."

	// Dedicated servers endpoint to work with.
	endpoint := "https://api.selectel.ru/servers/v2"

	// Create the client.
	client := dedicated.NewClientV2(token, endpoint)

	// Get the os for location.
	q := &dedicated.OperatingSystemsQuery{LocationID: "some-location-uuid"}
	operatingSystems, _, err := client.OperatingSystems(context.Background(), q)
	if err != nil {
		log.Fatal(err)
	}

	// Print the os.
	for idx, os := range operatingSystems {
		fmt.Printf("OS %d: %+v", idx, os)
	}
}

About

Go SDK for Selectel Dedicated Servers

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •