controller

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 34 Imported by: 1

Documentation

Overview

Package classification Netmaker

API Usage

Most actions that can be performed via API can be performed via UI. We recommend managing your networks using the official netmaker-ui project. However, Netmaker can also be run without the UI, and all functions can be achieved via API calls. If your use case requires using Netmaker without the UI or you need to do some troubleshooting/advanced configuration, using the API directly may help.

Authentication

API calls must be authenticated via a header of the format -H “Authorization: Bearer <YOUR_SECRET_KEY>” There are two methods to obtain YOUR_SECRET_KEY: 1. Using the masterkey. By default, this value is “secret key,” but you should change this on your instance and keep it secure. This value can be set via env var at startup or in a config file (config/environments/< env >.yaml). See the [Netmaker](https://docs.netmaker.org/index.html) documentation for more details. 2. Using a JWT received for a node. This can be retrieved by calling the /api/nodes/<network>/authenticate endpoint, as documented below.

Schemes: https
BasePath: /
Version: 0.24.0
Host: api.demo.netmaker.io

Consumes:
- application/json

Produces:
- application/json

Security:
- oauth

swagger:meta

Index

Constants

This section is empty.

Variables

View Source
var HttpHandlers = []interface{}{
	nodeHandlers,
	userHandlers,
	networkHandlers,
	dnsHandlers,
	fileHandlers,
	serverHandlers,
	extClientHandlers,
	ipHandlers,
	loggerHandlers,
	hostHandlers,
	enrollmentKeyHandlers,
	legacyHandlers,
}

HttpHandlers - handler functions for REST interactions

View Source
var HttpMiddlewares []mux.MiddlewareFunc

HttpMiddlewares - middleware functions for REST interactions

Functions

func Authorize

func Authorize(hostAllowed, networkCheck bool, authNetwork string, next http.Handler) http.HandlerFunc

The middleware for most requests to the API They all pass through here first This will validate the JWT (or check for master token) This will also check against the authNetwork and make sure the node should be accessing that endpoint, even if it's technically ok This is kind of a poor man's RBAC. There's probably a better/smarter way. TODO: Consider better RBAC implementations

func GetDNSEntry

func GetDNSEntry(domain string, network string) (models.DNSEntry, error)

GetDNSEntry - gets a DNS entry

func HandleRESTRequests

func HandleRESTRequests(wg *sync.WaitGroup, ctx context.Context)

HandleRESTRequests - handles the rest requests

Types

type EnrollmentKey

type EnrollmentKey struct {
	// in: body
	EnrollmentKey models.EnrollmentKey
}

type EnrollmentKeys

type EnrollmentKeys struct {
	// in: body
	EnrollmentKeys []models.EnrollmentKey
}

type HostFromNetworkParams

type HostFromNetworkParams struct {
	// hostid to add or delete from network
	// in: path
	HostID string `json:"hostid"`
	// network
	// in: path
	Network string `json:"network"`
}

swagger:parameters addHostToNetwork deleteHostFromNetwork

type HostID

type HostID struct {
	// HostID
	// in: path
	HostID string `json:"hostid"`
}

swagger:parameters synchost deleteHost updateHost signalPeer updateKeys

type NetworkParam

type NetworkParam struct {
	// name: network name
	// in:  path
	Networkname string `json:"networkname"`
}

swagger:parameters getNetwork deleteNetwork updateNetwork getNetworkACL updateNetworkACL

type RegisterParams

type RegisterParams struct {
	// in: path
	Token string `json:"token"`
	// in: body
	Host models.Host `json:"host"`
}

swagger:parameters handleHostRegister

type RegisterResponse

type RegisterResponse struct {
	// in: body
	RegisterResponse models.RegisterResponse
}

swagger:response RegisterResponse

type RemoteAccessGatewayUser

type RemoteAccessGatewayUser struct {
	// in: path
	Username string `json:"username"`
}

swagger:parameters attachUserToRemoteAccessGateway removeUserFromRemoteAccessGW getUserRemoteAccessGws

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL