Documentation
¶
Overview ¶
Package wnc provides a unified Go SDK for the Cisco Catalyst C9800 Wireless LAN Controller RESTCONF API.
This SDK enables developers to communicate with Cisco Catalyst 9800 controllers in an idiomatic, robust, and maintainable way using Go. It provides access to wireless controller configuration, operational data, and management functions through domain-specific service interfaces.
Index ¶
- Constants
- Variables
- func GetDataInto[T any](ctx context.Context, c *Client, path string, opts ...GetOption) (*T, error)
- type APIError
- type Client
- func (c *Client) AFC() afc.Service
- func (c *Client) AP() ap.Service
- func (c *Client) APF() apf.Service
- func (c *Client) AWIPS() awips.Service
- func (c *Client) BLE() ble.Service
- func (c *Client) CTS() cts.Service
- func (c *Client) Client() client.Service
- func (c *Client) CloseIdleConnections()
- func (c *Client) Controller() controller.Service
- func (c *Client) DeleteData(ctx context.Context, path string) ([]byte, error)
- func (c *Client) Dot11() dot11.Service
- func (c *Client) Dot15() dot15.Service
- func (c *Client) Fabric() fabric.Service
- func (c *Client) Flex() flex.Service
- func (c *Client) General() general.Service
- func (c *Client) Geolocation() geolocation.Service
- func (c *Client) GetData(ctx context.Context, path string, opts ...GetOption) ([]byte, error)
- func (c *Client) Hyperlocation() hyperlocation.Service
- func (c *Client) LISP() lisp.Service
- func (c *Client) Location() location.Service
- func (c *Client) MDNS() mdns.Service
- func (c *Client) Mcast() mcast.Service
- func (c *Client) Mesh() mesh.Service
- func (c *Client) Mobility() mobility.Service
- func (c *Client) NMSP() nmsp.Service
- func (c *Client) PatchData(ctx context.Context, path string, payload any) ([]byte, error)
- func (c *Client) PolicyTag() *wlan.PolicyTagService
- func (c *Client) PostData(ctx context.Context, path string, payload any) ([]byte, error)
- func (c *Client) PostRPC(ctx context.Context, path string, payload any) ([]byte, error)
- func (c *Client) PutData(ctx context.Context, path string, payload any) ([]byte, error)
- func (c *Client) RF() rf.Service
- func (c *Client) RFID() rfid.Service
- func (c *Client) RFTag() *rf.RFTagService
- func (c *Client) RRM() rrm.Service
- func (c *Client) Radio() radio.Service
- func (c *Client) Request(ctx context.Context, method, path string, payload any) (*Response, error)
- func (c *Client) Rogue() rogue.Service
- func (c *Client) Site() site.Service
- func (c *Client) SiteTag() *site.SiteTagService
- func (c *Client) Spaces() spaces.Service
- func (c *Client) URWB() urwb.Service
- func (c *Client) WAT() wat.Service
- func (c *Client) WLAN() wlan.Service
- type DefaultsMode
- type GetOption
- type Option
- func WithClientCertificate(cert tls.Certificate) Option
- func WithInsecureSkipVerify(skip bool) Option
- func WithLogger(l *slog.Logger) Option
- func WithProxy(fn func(*http.Request) (*url.URL, error)) Option
- func WithResponseHeaderTimeout(d time.Duration) Option
- func WithRootCAs(pool *x509.CertPool) Option
- func WithTLSHandshakeTimeout(d time.Duration) Option
- func WithTimeout(d time.Duration) Option
- func WithUserAgent(ua string) Option
- type Response
Constants ¶
const ( // DefaultTimeout is the default whole-request timeout (re-export of core.DefaultTimeout). DefaultTimeout = core.DefaultTimeout // DefaultResponseHeaderTimeout is the default budget for the response headers, five seconds, // which WithTimeout does not lift; raise it with WithResponseHeaderTimeout. DefaultResponseHeaderTimeout = core.DefaultResponseHeaderTimeout // DefaultTLSHandshakeTimeout is the default budget for the TLS handshake, five seconds, which // WithTimeout does not lift; raise it with WithTLSHandshakeTimeout. DefaultTLSHandshakeTimeout = core.DefaultTLSHandshakeTimeout )
Default request budgets. A request is bounded by all three, and WithTimeout sets only the first.
const ( // ReportAll materializes the leaves in force at their schema default. ReportAll = core.DefaultsReportAll // Explicit returns the leaves a client set, including any set to their schema default. Explicit = core.DefaultsExplicit )
Variables ¶
var ( ErrAuthenticationFailed = core.ErrAuthenticationFailed ErrAccessForbidden = core.ErrAccessForbidden ErrResourceNotFound = core.ErrResourceNotFound ErrInvalidConfiguration = core.ErrInvalidConfiguration ErrRequestTimeout = core.ErrRequestTimeout )
Error sentinels re-exported for consumer side error handling with errors.Is.
Functions ¶
func GetDataInto ¶ added in v0.10.0
GetDataInto reads a RESTCONF data path this package has no typed accessor for and decodes it into T, applying the envelope check every typed accessor gets: the response must carry exactly one top-level key, module-qualified and naming the node the path asked for, and T must declare a field for that key. GetData leaves all of that to the caller.
T is the envelope type, so it must be a struct whose outermost tag is the module-qualified node name — the shape every Cisco…Data type in this module's service packages has. A map or any other non-struct is refused, because the check asks whether T can consume the key rather than trusting it to. The check is top-level only: a tag below the top naming a node the response does not carry still decodes to nothing.
It is a function rather than a method on Client because a generic method, which this toolchain does accept, may not be declared in an interface and is invisible to reflect — so a consumer could neither put this behind a seam of its own nor reach it by reflection.
Types ¶
type APIError ¶
APIError is returned for HTTP error responses (type alias to preserve instanceof semantics with errors.As).
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the unified WNC API client with access to all domain services. This provides a single-import approach to accessing all wireless controller functionality.
func NewClient ¶
NewClient creates a new unified WNC client with the specified host, token, and options. This is the main entry point for all wireless controller operations.
host is an authority and nothing else — "wnc1.example.internal" or "192.0.2.10:443". A scheme, a path, a query, a fragment, userinfo or an IPv6 zone id is refused with ErrInvalidConfiguration rather than concatenated into a URL that reads another node.
func (*Client) AWIPS ¶ added in v0.2.0
AWIPS returns the Automated Wireless Intrusion Prevention System service.
func (*Client) CloseIdleConnections ¶ added in v0.10.0
func (c *Client) CloseIdleConnections()
CloseIdleConnections closes the pooled connections that have no request on them, releasing the sockets a long-lived process would otherwise hold open after its last read. A connection in use is left alone and the client stays usable afterwards: the next request dials again.
func (*Client) Controller ¶ added in v0.3.0
func (c *Client) Controller() controller.Service
Controller returns the controller management service.
func (*Client) DeleteData ¶ added in v0.9.0
DeleteData removes a node at a RESTCONF data path (RFC 8040 4.7).
func (*Client) Geolocation ¶ added in v0.2.0
func (c *Client) Geolocation() geolocation.Service
Geolocation returns the geolocation service.
func (*Client) GetData ¶ added in v0.6.0
GetData reads a RESTCONF data path this package has no typed accessor for and returns the body as received. The /restconf/data prefix is optional and GetOption values apply as they do to a typed read.
Three things the body does not say for itself. The response carries exactly one top-level key, the module-qualified name of the node requested, so check that key rather than trusting a struct tag: a tag naming a key the controller did not send decodes to nothing and reports success. A node holding nothing answers with no body, so the slice is non-nil and empty with a nil error — check the length before decoding. The path is sent as given, so a caller keying into a list escapes the key itself, an unescaped "#" or "?" ending the path early and reading a different node without error.
func (*Client) Hyperlocation ¶ added in v0.2.0
func (c *Client) Hyperlocation() hyperlocation.Service
Hyperlocation returns the hyperlocation service.
func (*Client) PatchData ¶ added in v0.9.0
PatchData merges a payload into a node at a RESTCONF data path. This package sends application/yang-data+json, so the edit is the plain patch of RFC 8040 4.6.1: a leaf absent from the payload is left alone, and no payload deletes anything.
A typed struct cannot clear a leaf, because encoding/json drops a zero field carrying omitempty before the payload is built, and its absence then means "leave alone". Send the leaf as bytes to set it to its zero, and DeleteData to remove it.
func (*Client) PolicyTag ¶ added in v0.3.0
func (c *Client) PolicyTag() *wlan.PolicyTagService
PolicyTag returns the Policy Tag service for policy tag management operations. This provides direct access to policy tag CRUD operations without going through WLAN service.
func (*Client) PostData ¶ added in v0.9.0
PostData creates a node under a RESTCONF data path (RFC 8040 4.4).
func (*Client) PostRPC ¶ added in v0.9.0
PostRPC invokes an operation on a RESTCONF operations path (RFC 8040 3.6 and 4.4.2). The path is the RPC name, module-qualified as the controller publishes it, with or without the /restconf/operations prefix, and the payload is normally an object under a single "input" key.
func (*Client) PutData ¶ added in v0.9.0
PutData replaces a node at a RESTCONF data path (RFC 8040 4.5). A typed struct carrying omitempty marshals fewer leaves than it decoded, so replacing a node with one removes the rest.
func (*Client) RFTag ¶ added in v0.3.0
func (c *Client) RFTag() *rf.RFTagService
RFTag returns the RF Tag service for RF tag management operations. This provides direct access to RF tag CRUD operations without going through RF service.
func (*Client) Request ¶ added in v0.9.0
Request performs a request with the given method on the path as the caller wrote it, for whatever the verb methods above cannot express: a method RESTCONF gains later, a bodiless probe such as HEAD, or a query parameter this package has no option for.
A path already under /restconf/operations is sent to the operations root and anything else to the data root, which passes a /restconf/data-prefixed path through and prefixes a bare one.
On the data root the method is sent as given and is checked against neither the path nor the payload; the one value rejected is the empty string, which net/http reads as GET. The operations root takes POST alone, and another method there is refused rather than replaced: this package would send POST regardless, invoking the operation instead of doing what was asked.
This is the one method here that returns the status as well as the body, because it is the one with no fixed verb: 201, 204 and an empty 200 all answer with no body, so the body alone cannot say whether the node held nothing, was created or was replaced. The Response is non-nil exactly when the error is nil, and a status of 400 or above arrives as an *APIError rather than in it.
func (*Client) SiteTag ¶ added in v0.3.0
func (c *Client) SiteTag() *site.SiteTagService
SiteTag returns the Site Tag service for site tag management operations. This provides direct access to site tag CRUD operations without going through Site service.
func (*Client) Spaces ¶ added in v0.3.0
Spaces returns the Cisco Spaces integration service. EXPERIMENTAL: Requires IOS-XE 17.15.1+.
func (*Client) URWB ¶ added in v0.3.0
URWB returns the Ultra Reliable Wireless Backhaul service. EXPERIMENTAL: Requires IOS-XE 17.18.1+.
type DefaultsMode ¶ added in v0.4.3
type DefaultsMode = core.DefaultsMode
DefaultsMode selects the RFC 6243 retrieval mode for WithDefaults.
type GetOption ¶ added in v0.4.3
GetOption customizes a single GET request (re-export of internal core.GetOption).
func WithDefaults ¶ added in v0.4.3
func WithDefaults(mode DefaultsMode) GetOption
WithDefaults requests the given with-defaults retrieval mode (RFC 8040 4.8.9). Scope it to the container that needs it: on a whole-container read the added leaves accumulate across every nested container.
func WithDepth ¶ added in v0.6.0
WithDepth limits the answer to an RFC 8040 4.8.2 subtree depth (re-export wrapper). A node the limit cuts is absent exactly as a pruned leaf is, so an absent leaf still decodes to a zero value; bound the depth to what the caller reads.
func WithFields ¶ added in v0.6.0
WithFields limits the answer to an RFC 8040 4.8.3 fields expression (re-export wrapper). A pruned leaf is absent, and an absent leaf decodes to a zero value, so prune only the fields the caller reads.
type Option ¶ added in v0.2.0
Option is a functional option for configuring the unified client (re-export of internal core.Option). This allows end users to supply options without importing the internal/core package.
func WithClientCertificate ¶ added in v0.10.0
func WithClientCertificate(cert tls.Certificate) Option
WithClientCertificate presents cert to the controller (re-export wrapper), for a deployment that authenticates the client with mTLS as well as with the Authorization header.
func WithInsecureSkipVerify ¶
WithInsecureSkipVerify controls TLS certificate verification (lab/testing only).
func WithLogger ¶
WithLogger sets a custom slog.Logger. Unset, the client logs to slog.Default(), so pass WithLogger(slog.New(slog.DiscardHandler)) where the SDK should write nothing.
func WithProxy ¶ added in v0.6.0
WithProxy routes requests through the proxy the resolver returns (re-export wrapper).
func WithResponseHeaderTimeout ¶ added in v0.6.0
WithResponseHeaderTimeout bounds the wait for the response headers (re-export wrapper).
func WithRootCAs ¶ added in v0.10.0
WithRootCAs verifies the controller's certificate against pool instead of the host's roots (re-export wrapper). Prefer it to WithInsecureSkipVerify where the controller presents a certificate from a private CA: the certificate is then verified rather than unverified.
func WithTLSHandshakeTimeout ¶ added in v0.6.0
WithTLSHandshakeTimeout bounds the TLS handshake (re-export wrapper).
func WithTimeout ¶
WithTimeout sets the whole-request timeout (re-export wrapper). It lifts neither DefaultResponseHeaderTimeout nor DefaultTLSHandshakeTimeout, so a caller that raises this alone is still capped at five seconds for the headers, which is when a busy controller is slowest. Raise those with WithResponseHeaderTimeout and WithTLSHandshakeTimeout.
func WithUserAgent ¶ added in v0.2.0
WithUserAgent sets a custom User-Agent header value.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
core
Package core provides the foundational HTTP client and transport layer for Cisco IOS-XE Wireless Controller SDK.
|
Package core provides the foundational HTTP client and transport layer for Cisco IOS-XE Wireless Controller SDK. |
|
errors
Package errors provides standardized error definitions and templates for Cisco IOS-XE Wireless Controller services.
|
Package errors provides standardized error definitions and templates for Cisco IOS-XE Wireless Controller services. |
|
restconf
Package restconf provides RESTCONF URL building and path construction utilities.
|
Package restconf provides RESTCONF URL building and path construction utilities. |
|
restconf/routes
Package routes provides centralized RESTCONF API endpoint constants for all services.
|
Package routes provides centralized RESTCONF API endpoint constants for all services. |
|
service
Package service provides common BaseService infrastructure for Cisco IOS-XE Wireless Controller services.
|
Package service provides common BaseService infrastructure for Cisco IOS-XE Wireless Controller services. |
|
testutil
Package testutil provides internal test helpers and utilities for unit testing.
|
Package testutil provides internal test helpers and utilities for unit testing. |
|
transport
Package transport provides HTTP transport configuration and request building utilities.
|
Package transport provides HTTP transport configuration and request building utilities. |
|
validation
Package validation provides input validation utilities for Cisco IOS-XE Wireless Controller client.
|
Package validation provides input validation utilities for Cisco IOS-XE Wireless Controller client. |
|
version
Package version holds this module's version as a compile-time constant.
|
Package version holds this module's version as a compile-time constant. |
|
pkg
|
|
|
testutil
Package testutil provides testing utilities for the Cisco IOS-XE Wireless Go SDK.
|
Package testutil provides testing utilities for the Cisco IOS-XE Wireless Go SDK. |
|
service
|
|
|
afc
Package afc provides Automated Frequency Coordination (AFC) functionality for the Cisco IOS-XE Wireless Network Controller API.
|
Package afc provides Automated Frequency Coordination (AFC) functionality for the Cisco IOS-XE Wireless Network Controller API. |
|
ap
Package ap provides access point functionality for the Cisco IOS-XE Wireless Network Controller API.
|
Package ap provides access point functionality for the Cisco IOS-XE Wireless Network Controller API. |
|
apf
Package apf provides Application Policy Framework (APF) functionality for the Cisco IOS-XE Wireless Network Controller API.
|
Package apf provides Application Policy Framework (APF) functionality for the Cisco IOS-XE Wireless Network Controller API. |
|
awips
Package awips provides Automated Wireless Intrusion Prevention System (AWIPS) functionality for the Cisco IOS-XE Wireless Network Controller API.
|
Package awips provides Automated Wireless Intrusion Prevention System (AWIPS) functionality for the Cisco IOS-XE Wireless Network Controller API. |
|
ble
Package ble provides Bluetooth Low Energy (BLE) functionality for the Cisco IOS-XE Wireless Network Controller API.
|
Package ble provides Bluetooth Low Energy (BLE) functionality for the Cisco IOS-XE Wireless Network Controller API. |
|
client
Package client provides wireless client operational operations for Cisco IOS-XE wireless controllers.
|
Package client provides wireless client operational operations for Cisco IOS-XE wireless controllers. |
|
controller
Package controller provides wireless controller management functionality for the Cisco IOS-XE Wireless Network Controller API.
|
Package controller provides wireless controller management functionality for the Cisco IOS-XE Wireless Network Controller API. |
|
cts
Package cts provides Cisco TrustSec (CTS) SXP configuration operations for Cisco IOS-XE wireless controllers.
|
Package cts provides Cisco TrustSec (CTS) SXP configuration operations for Cisco IOS-XE wireless controllers. |
|
dot11
Package dot11 provides 802.11 wireless standard configuration operations for Cisco IOS-XE wireless controllers.
|
Package dot11 provides 802.11 wireless standard configuration operations for Cisco IOS-XE wireless controllers. |
|
dot15
Package dot15 provides 802.15 wireless standard configuration operations for Cisco IOS-XE wireless controllers.
|
Package dot15 provides 802.15 wireless standard configuration operations for Cisco IOS-XE wireless controllers. |
|
fabric
Package fabric provides SD-Access fabric configuration operations for Cisco IOS-XE wireless controllers.
|
Package fabric provides SD-Access fabric configuration operations for Cisco IOS-XE wireless controllers. |
|
flex
Package flex provides FlexConnect configuration operations for Cisco IOS-XE wireless controllers.
|
Package flex provides FlexConnect configuration operations for Cisco IOS-XE wireless controllers. |
|
general
Package general provides general controller configuration and operational operations for Cisco IOS-XE wireless controllers.
|
Package general provides general controller configuration and operational operations for Cisco IOS-XE wireless controllers. |
|
geolocation
Package geolocation provides geographic location services operational operations for Cisco IOS-XE wireless controllers.
|
Package geolocation provides geographic location services operational operations for Cisco IOS-XE wireless controllers. |
|
hyperlocation
Package hyperlocation provides high-precision location tracking operational operations for Cisco IOS-XE wireless controllers.
|
Package hyperlocation provides high-precision location tracking operational operations for Cisco IOS-XE wireless controllers. |
|
lisp
Package lisp provides Locator/ID Separation Protocol (LISP) operational operations for Cisco IOS-XE wireless controllers.
|
Package lisp provides Locator/ID Separation Protocol (LISP) operational operations for Cisco IOS-XE wireless controllers. |
|
location
Package location provides location services configuration operations for Cisco IOS-XE wireless controllers.
|
Package location provides location services configuration operations for Cisco IOS-XE wireless controllers. |
|
mcast
Package mcast provides multicast operational operations for Cisco IOS-XE wireless controllers.
|
Package mcast provides multicast operational operations for Cisco IOS-XE wireless controllers. |
|
mdns
Package mdns provides multicast DNS (mDNS) operational operations for Cisco IOS-XE wireless controllers.
|
Package mdns provides multicast DNS (mDNS) operational operations for Cisco IOS-XE wireless controllers. |
|
mesh
Package mesh provides wireless mesh networking configuration and operational operations for Cisco IOS-XE wireless controllers.
|
Package mesh provides wireless mesh networking configuration and operational operations for Cisco IOS-XE wireless controllers. |
|
mobility
Package mobility provides wireless client mobility operational operations for Cisco IOS-XE wireless controllers.
|
Package mobility provides wireless client mobility operational operations for Cisco IOS-XE wireless controllers. |
|
nmsp
Package nmsp provides Network Mobility Services Protocol (NMSP) operational operations for Cisco IOS-XE wireless controllers.
|
Package nmsp provides Network Mobility Services Protocol (NMSP) operational operations for Cisco IOS-XE wireless controllers. |
|
radio
Package radio provides radio hardware configuration operations for Cisco IOS-XE wireless controllers.
|
Package radio provides radio hardware configuration operations for Cisco IOS-XE wireless controllers. |
|
rf
Package rf provides radio frequency operations for Cisco IOS-XE wireless controllers.
|
Package rf provides radio frequency operations for Cisco IOS-XE wireless controllers. |
|
rfid
Package rfid provides Radio Frequency Identification (RFID) configuration and operational operations for Cisco IOS-XE wireless controllers.
|
Package rfid provides Radio Frequency Identification (RFID) configuration and operational operations for Cisco IOS-XE wireless controllers. |
|
rogue
Package rogue provides rogue detection operational operations for Cisco IOS-XE wireless controllers.
|
Package rogue provides rogue detection operational operations for Cisco IOS-XE wireless controllers. |
|
rrm
Package rrm provides Radio Resource Management (RRM) configuration and operational operations for Cisco IOS-XE wireless controllers.
|
Package rrm provides Radio Resource Management (RRM) configuration and operational operations for Cisco IOS-XE wireless controllers. |
|
site
Package site provides site-specific configuration and operational operations for Cisco IOS-XE wireless controllers.
|
Package site provides site-specific configuration and operational operations for Cisco IOS-XE wireless controllers. |
|
spaces
Package spaces provides Cisco Spaces integration functionality for the Cisco IOS-XE Wireless Network Controller API.
|
Package spaces provides Cisco Spaces integration functionality for the Cisco IOS-XE Wireless Network Controller API. |
|
urwb
Package urwb provides Ultra Reliable Wireless Backhaul (URWB) functionality for the Cisco IOS-XE Wireless Network Controller API.
|
Package urwb provides Ultra Reliable Wireless Backhaul (URWB) functionality for the Cisco IOS-XE Wireless Network Controller API. |
|
wat
Package wat provides client access to Cisco Wireless Application Templates (WAT) integration.
|
Package wat provides client access to Cisco Wireless Application Templates (WAT) integration. |
|
wlan
Package wlan provides Wireless LAN (WLAN) configuration and operational operations for Cisco IOS-XE wireless controllers.
|
Package wlan provides Wireless LAN (WLAN) configuration and operational operations for Cisco IOS-XE wireless controllers. |