Skip to content

kolsean/go-selvpcclient

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-selvpcclient: a Go library for the Selectel VPC API

GoDoc Go Report Card Build Status Coverage Status

Package go-selvpcclient provides a Go library to work with the Selectel VPC API.

Documentation

The Go library documentation is available at godoc.org.

The API usage examples are available at knowledge base.
API documentation is also available at the VPC page (if you've created an account on the registration page).

What this library is capable of

You can use this library to work with the following objects of the Selectel VPC API:

Selectel VPC Cloud is based on the OpenStack, so you don't need this library to work with actual servers, volumes, networks, etc.
You can use the Gophercloud project to work with the OpenStack objects.

Getting started

Installation

You can install go-selvpcclient as a Go package:

go get github.com/selectel/go-selvpcclient/selvpcclient

Authentication

To work with the Selectel VPC API you first need to:

Usage example

package main

import (
  "context"
  "fmt"
  "log"

  resell "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2"
  "github.com/selectel/go-selvpcclient/selvpcclient/resell/v2/projects"
)

// API token from the https://my.selectel.ru.
var token = "token_key"

func main() {
  // Initialize the Resell V2 client.
  resellClient := resell.NewV2ResellClient(token)

  // Get and print all projects.
  ctx := context.Background()
  allProjects, _, err := projects.List(ctx, resellClient)
  if err != nil {
    log.Fatal(err)
  }
  for _, myProject := range allProjects {
    fmt.Println(myProject)
  }
}

About

A Go library for the Selectel VPC API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.7%
  • Other 0.3%