Skip to content

selectel/globalrouter-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

globalrouter-go

Go SDK for Selectel Global Router resources

Getting started

Installation

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

go get github.com/selectel/globalrouter-go

Authentication

To work with the Selectel global-router Servers API you first need to:

Endpoints

You can find available endpoints here.

Usage example

package main

import (
	"context"
	"fmt"

	globalrouter "github.com/selectel/globalrouter-go/pkg/v1"
)

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

	// Global router endpoint to work with.
	endpoint := "https://api.selectel.ru/naas/v1"

	// Create the client.
	client := globalrouter.NewClientV1(
		token,	
		globalrouter.WithAPIUrl("https://api.selectel.ru/naas/v1"),
	)

	// Get all Zones with specified name
	zones, _, _ := client.ListZones(ctx, nil)

	// Print all cloud zones
	for _, zone := range *zones {
		if zone.Service == "vpc" {
			fmt.Printf("Zone name: %s\n", zone.Name)
		}
	}
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published