omada

package module
v0.0.0-...-ce23bd5 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 10 Imported by: 0

README

Omada API Client

Newer versions of the Omada SDN controller allow for programmatic access to functionality through an API. The specification for this API is defined in using OpenAPI. While the majority of functionality is specified using OpenAPI, the authentication framework is implemented separately.

This project is a thin wrapper around the auto-generated OpenAPI classes that includes authentication token handling; automatically obtaining an access and refresh token using the supplied information. This assumes the client credential flow is used.

See an example in cmd/omadacli for a small tool which finds all the sites that the controller is managing and dumps all the wireless devices connected.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrObtainTokenFailed  = errors.New("obtaining an API auth token failed")
	ErrRefreshTokenFailed = errors.New("refreshing the API auth token failed")
	ErrTokenInvalid       = errors.New("token invalid")
	ErrTokenExpired       = errors.New("token expired")
)

Functions

func IsTokenExpired

func IsTokenExpired(errCode int32) bool

Types

type Client

type Client struct {
	*api.ClientWithResponses
	// contains filtered or unexported fields
}

func NewClient

func NewClient(logger *zap.Logger, controllerURL string, omadaCID string, clientID string, clientSecret string, httpClient *http.Client) *Client

func (*Client) GetSites

func (c *Client) GetSites(ctx context.Context) ([]Site, error)

type Site

type Site struct {
	ID   string
	Name string
}

Directories

Path Synopsis
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
cmd
omadacli command

Jump to

Keyboard shortcuts

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