Skip to content

selectel/public-net-api-go

Repository files navigation

public-net-api-go

Go SDK for the Selectel Cloud Public Net API service for managing networking resources - direct public IP addresses (which are represented as public ports).

For example, it is used the Selectel Terraform Provider.

Getting started

Installation

You can install needed public-net-api-go packages via go get command:

go get github.com/selectel/public-net-api-go

Authentication

To work with the Selectel Public Net API you first need to:

Endpoints

You can find available endpoints here.

Usage example

package main

import (
	"context"
	"fmt"
	"log"

	publicnetapi "github.com/selectel/public-net-api-go/pkg/v1"
)

func main() {
	cfg := &publicnetapi.Config{
		AuthToken: "...",
		URL:       "https://ru-3.cloud.api.selcloud.ru/public-net/",
	}

	client, err := publicnetapi.NewPublicNetAPIClient(cfg)
	if err != nil {
		log.Fatal(err)
	}

	ports, err := client.ListPorts(context.Background(), nil)
	if err != nil {
		log.Fatal(err)
	}

	for _, port := range ports {
		fmt.Printf("Port %s: %s\n", port.ID, port.IPAddress)
	}
}

Supported operations

  • Port — List, Get, Create, Update, Delete
  • Project quotas — Get

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors