Documentation
¶
Index ¶
- func CollectAll[T any](ctx context.Context, ...) ([]T, error)
- type APIError
- type Client
- func (c *Client) Ap() *ap.Client
- func (c *Client) Clients() *client.Client
- func (c *Client) Devices() *device.Client
- func (c *Client) Gateway() *gateway.Client
- func (c *Client) Insight() *insight.Client
- func (c *Client) InvalidateToken()
- func (c *Client) Lan() *lan.Client
- func (c *Client) Msp() *msp.Client
- func (c *Client) OmadaLog() *omadalog.Client
- func (c *Client) Remote() *remote.Client
- func (c *Client) Security() *security.Client
- func (c *Client) Sim() *sim.Client
- func (c *Client) Site() *site.Client
- func (c *Client) Stack() *stack.Client
- func (c *Client) Switch() *switchpkg.Client
- func (c *Client) Topology() *topology.Client
- func (c *Client) Users() *user.Client
- func (c *Client) Voip() *voip.Client
- func (c *Client) Vpn() *vpn.Client
- func (c *Client) Wireless() *wireless.Client
- type Options
- type OrgTokenProvider
- type Page
- type TokenProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectAll ¶
func CollectAll[T any](ctx context.Context, fetch func(ctx context.Context, page, pageSize int) (Page[T], error), pageSize int, maxRows int64) ([]T, error)
CollectAll fetches pages via fetch(ctx, page, pageSize) starting at page 1 until it has TotalRows rows (when known), a short page, or maxRows rows. A first error from fetch stops collection and is returned. The result never exceeds maxRows, and never exceeds TotalRows when it is known: a page that crosses the total is truncated to it.
Types ¶
type APIError ¶
APIError is a northbound API envelope error: a non-zero errorCode in the {errorCode, msg, ...} response envelope.
func NewAPIError ¶
NewAPIError creates an APIError from an envelope errorCode and msg.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a northbound Omada cloud API client. Every domain accessor returns a generated client whose requests flow through the auth transport.
func New ¶
New creates a Client. Exactly one credential set must be provided: hosted (Username + Password) or on-prem org-level (OmadacID + ClientID + ClientSecret); both or neither is an error. BaseURL defaults to the hosted US-1 endpoint only in hosted mode; on-prem mode requires an explicit BaseURL.
func (*Client) InvalidateToken ¶
func (c *Client) InvalidateToken()
InvalidateToken drops the cached token so the next request re-authenticates.
func (*Client) Switch ¶
func (c *Client) Switch() *switchpkg.Client
Switch returns the switch domain client.
type Options ¶
type Options struct {
BaseURL string
Username string // hosted mode
Password string // hosted mode
OmadacID string // on-prem org-level mode
ClientID string // on-prem org-level mode
ClientSecret string // on-prem org-level mode
HTTPClient *http.Client
}
Options configures a northbound cloud Client. Exactly one credential set is required: hosted (Username + Password) or on-prem org-level (OmadacID + ClientID + ClientSecret). BaseURL defaults to the US-1 northbound endpoint only in hosted mode; it is required in on-prem mode.
type OrgTokenProvider ¶
type OrgTokenProvider struct {
// contains filtered or unexported fields
}
OrgTokenProvider fetches and caches an on-prem org-level Open API token via the client-credentials grant against the controller's own /openapi/authorize/token endpoint. The response is enveloped (errorCode/msg/result); a non-zero errorCode is an error. The returned refreshToken is not used: re-authentication always re-runs the client-credentials grant.
func NewOrgTokenProvider ¶
func NewOrgTokenProvider(baseURL, omadacID, clientID, clientSecret string, hc *http.Client) *OrgTokenProvider
func (*OrgTokenProvider) HeaderValue ¶
func (p *OrgTokenProvider) HeaderValue(ctx context.Context) (string, error)
HeaderValue returns the full Authorization header value for a request: "AccessToken=<token>".
func (*OrgTokenProvider) Invalidate ¶
func (p *OrgTokenProvider) Invalidate()
Invalidate drops the cached token so the next Token call refetches.
type TokenProvider ¶
type TokenProvider struct {
// contains filtered or unexported fields
}
TokenProvider fetches and caches a northbound client-credentials token.
func NewTokenProvider ¶
func NewTokenProvider(baseURL, username, password string, hc *http.Client) *TokenProvider
func (*TokenProvider) HeaderValue ¶
func (tp *TokenProvider) HeaderValue(ctx context.Context) (string, error)
HeaderValue returns the full Authorization header value for a request: "Bearer <token>".
func (*TokenProvider) Invalidate ¶
func (tp *TokenProvider) Invalidate()
Invalidate drops the cached token so the next Token call refetches.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ap provides primitives to interact with the openapi HTTP API.
|
Package ap provides primitives to interact with the openapi HTTP API. |
|
Package client provides primitives to interact with the openapi HTTP API.
|
Package client provides primitives to interact with the openapi HTTP API. |
|
Package device provides primitives to interact with the openapi HTTP API.
|
Package device provides primitives to interact with the openapi HTTP API. |
|
Package gateway provides primitives to interact with the openapi HTTP API.
|
Package gateway provides primitives to interact with the openapi HTTP API. |
|
Package insight provides primitives to interact with the openapi HTTP API.
|
Package insight provides primitives to interact with the openapi HTTP API. |
|
Package lan provides primitives to interact with the openapi HTTP API.
|
Package lan provides primitives to interact with the openapi HTTP API. |
|
Package log provides primitives to interact with the openapi HTTP API.
|
Package log provides primitives to interact with the openapi HTTP API. |
|
Package msp provides primitives to interact with the openapi HTTP API.
|
Package msp provides primitives to interact with the openapi HTTP API. |
|
Package remote provides primitives to interact with the openapi HTTP API.
|
Package remote provides primitives to interact with the openapi HTTP API. |
|
Package security provides primitives to interact with the openapi HTTP API.
|
Package security provides primitives to interact with the openapi HTTP API. |
|
Package sim provides primitives to interact with the openapi HTTP API.
|
Package sim provides primitives to interact with the openapi HTTP API. |
|
Package site provides primitives to interact with the openapi HTTP API.
|
Package site provides primitives to interact with the openapi HTTP API. |
|
Package stack provides primitives to interact with the openapi HTTP API.
|
Package stack provides primitives to interact with the openapi HTTP API. |
|
Package switchpkg provides primitives to interact with the openapi HTTP API.
|
Package switchpkg provides primitives to interact with the openapi HTTP API. |
|
Package topology provides primitives to interact with the openapi HTTP API.
|
Package topology provides primitives to interact with the openapi HTTP API. |
|
Package user provides primitives to interact with the openapi HTTP API.
|
Package user provides primitives to interact with the openapi HTTP API. |
|
Package voip provides primitives to interact with the openapi HTTP API.
|
Package voip provides primitives to interact with the openapi HTTP API. |
|
Package vpn provides primitives to interact with the openapi HTTP API.
|
Package vpn provides primitives to interact with the openapi HTTP API. |
|
Package wireless provides primitives to interact with the openapi HTTP API.
|
Package wireless provides primitives to interact with the openapi HTTP API. |