https://github.com/selectel/go-selvpcclient
A Go library for the Selectel VPC API
https://github.com/selectel/go-selvpcclient
go selectel selectel-vpc-api
Last synced: about 1 year ago
JSON representation
A Go library for the Selectel VPC API
- Host: GitHub
- URL: https://github.com/selectel/go-selvpcclient
- Owner: selectel
- License: apache-2.0
- Created: 2018-03-29T19:50:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-03-11T10:00:40.000Z (over 1 year ago)
- Last Synced: 2025-04-30T16:17:38.670Z (about 1 year ago)
- Topics: go, selectel, selectel-vpc-api
- Language: Go
- Size: 352 KB
- Stars: 11
- Watchers: 7
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# go-selvpcclient: a Go library for the Selectel VPC API
[](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient)
[](https://goreportcard.com/report/github.com/selectel/go-selvpcclient/v3)
[](https://coveralls.io/github/selectel/go-selvpcclient?branch=master)
Package go-selvpcclient provides a Go library to work with the Selectel API:
- [Cloud Management API](https://developers.selectel.ru/docs/selectel-cloud-platform/main-services/selectel_cloud_management_api/)
- [Cloud Quota Management API](https://developers.selectel.ru/docs/selectel-cloud-platform/main-services/cloud-quota-management/)
## Documentation
The Go library documentation is available at [godoc.org](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient).
## What this library is capable of
You can use this library to work with the following objects of the
[Cloud Management API](https://developers.selectel.ru/docs/selectel-cloud-platform/main-services/selectel_cloud_management_api/) and
[Cloud Quota Management API](https://developers.selectel.ru/docs/selectel-cloud-platform/main-services/cloud-quota-management/).
Cloud Management API:
- [capabilities](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/capabilities)
- [floating ips](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/floatingips)
- [keypairs](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/keypairs)
- [licenses](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/licenses)
- [projects](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/projects)
- [roles](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/roles)
- [subnets](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/subnets)
- [tokens](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/tokens)
- [traffic](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/traffic)
- [users](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/users)
Cloud Quota Management API:
- [quotas](https://godoc.org/github.com/selectel/go-selvpcclient/v4/selvpcclient/quotamanager/quotas)
Selectel VPC Cloud is based on the [OpenStack](https://www.openstack.org), so you don't need this library to work with actual servers, volumes, networks, etc.
You can use the [Gophercloud](https://github.com/gophercloud/gophercloud) project to work with the OpenStack objects.
## Getting started
### Installation
You can install `go-selvpcclient` as a Go package:
```bash
go get github.com/selectel/go-selvpcclient/selvpcclient/v4
```
### Authentication
To work with the Selectel VPC API you first need to:
- create a Selectel account: [registration page](https://my.selectel.ru/registration)
- create the service user: [users and roles](https://docs.selectel.ru/control-panel-actions/users-and-roles)
### Usage example
```go
package main
import (
"context"
"fmt"
"log"
"github.com/selectel/go-selvpcclient/v4/selvpcclient"
"github.com/selectel/go-selvpcclient/v4/selvpcclient/resell/v2/projects"
)
func main() {
ctx := context.Background()
options := &selvpcclient.ClientOptions{
Context: ctx,
DomainName: "999999",
AuthRegion: "",
AuthURL: "https://cloud.api.selcloud.ru/identity/v3/",
Username: "admin",
Password: "m1-sup3r-p@ssw0rd-p3w-p3w",
}
client, err := selvpcclient.NewClient(options)
if err != nil {
log.Fatal(err)
}
result, resp, err := projects.List(client)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Response StatusCode: %d \n", resp.StatusCode)
for _, project := range result {
fmt.Printf("Project name: %s, enabled: %t \n", project.Name, project.Enabled)
}
}
```