Initial version
Extracted from paultyng/terraform-provider-unifi@ef25893f14
This commit is contained in:
110
unifi/account.generated.go
Normal file
110
unifi/account.generated.go
Normal file
@@ -0,0 +1,110 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type Account struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
IP string `json:"ip"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
Name string `json:"name,omitempty"` // ^[^"' ]+$
|
||||
TunnelConfigType string `json:"tunnel_config_type,omitempty"` // vpn|802.1x|custom
|
||||
TunnelMediumType int `json:"tunnel_medium_type,omitempty"` // [1-9]|1[0-5]|^$
|
||||
TunnelType int `json:"tunnel_type,omitempty"` // [1-9]|1[0-3]|^$
|
||||
VLAN int `json:"vlan,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$
|
||||
XPassword string `json:"x_password,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listAccount(site string) ([]Account, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Account `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/account", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getAccount(site, id string) (*Account, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Account `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/account/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteAccount(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/account/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createAccount(site string, d *Account) (*Account, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Account `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/account", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateAccount(site string, d *Account) (*Account, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Account `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/account/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
105
unifi/broadcast_group.generated.go
Normal file
105
unifi/broadcast_group.generated.go
Normal file
@@ -0,0 +1,105 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type BroadcastGroup struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
MemberTable []string `json:"member_table,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listBroadcastGroup(site string) ([]BroadcastGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []BroadcastGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/broadcastgroup", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getBroadcastGroup(site, id string) (*BroadcastGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []BroadcastGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/broadcastgroup/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteBroadcastGroup(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/broadcastgroup/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createBroadcastGroup(site string, d *BroadcastGroup) (*BroadcastGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []BroadcastGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/broadcastgroup", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateBroadcastGroup(site string, d *BroadcastGroup) (*BroadcastGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []BroadcastGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/broadcastgroup/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
108
unifi/dhcp_option.generated.go
Normal file
108
unifi/dhcp_option.generated.go
Normal file
@@ -0,0 +1,108 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type DHCPOption struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Code string `json:"code,omitempty"` // ^(?!(?:15|42|43|44|51|66|67|252)$)([7-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-4])$
|
||||
Name string `json:"name,omitempty"` // ^[A-Za-z0-9-_]{1,25}$
|
||||
Signed bool `json:"signed"`
|
||||
Type string `json:"type,omitempty"` // ^(boolean|hexarray|integer|ipaddress|macaddress|text)$
|
||||
Width int `json:"width,omitempty"` // ^(8|16|32)$
|
||||
}
|
||||
|
||||
func (c *Client) listDHCPOption(site string) ([]DHCPOption, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DHCPOption `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/dhcpoption", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getDHCPOption(site, id string) (*DHCPOption, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DHCPOption `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/dhcpoption/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteDHCPOption(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/dhcpoption/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createDHCPOption(site string, d *DHCPOption) (*DHCPOption, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DHCPOption `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/dhcpoption", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateDHCPOption(site string, d *DHCPOption) (*DHCPOption, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DHCPOption `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/dhcpoption/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
111
unifi/dpi_app.generated.go
Normal file
111
unifi/dpi_app.generated.go
Normal file
@@ -0,0 +1,111 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type DpiApp struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Apps []int `json:"apps,omitempty"`
|
||||
Blocked bool `json:"blocked"`
|
||||
Cats []int `json:"cats,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Log bool `json:"log"`
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
QOSRateMaxDown int `json:"qos_rate_max_down,omitempty"` // -1|[2-9]|[1-9][0-9]{1,4}|100000|10[0-1][0-9]{3}|102[0-3][0-9]{2}|102400
|
||||
QOSRateMaxUp int `json:"qos_rate_max_up,omitempty"` // -1|[2-9]|[1-9][0-9]{1,4}|100000|10[0-1][0-9]{3}|102[0-3][0-9]{2}|102400
|
||||
}
|
||||
|
||||
func (c *Client) listDpiApp(site string) ([]DpiApp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DpiApp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/dpiapp", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getDpiApp(site, id string) (*DpiApp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DpiApp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/dpiapp/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteDpiApp(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/dpiapp/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createDpiApp(site string, d *DpiApp) (*DpiApp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DpiApp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/dpiapp", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateDpiApp(site string, d *DpiApp) (*DpiApp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DpiApp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/dpiapp/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
106
unifi/dpi_group.generated.go
Normal file
106
unifi/dpi_group.generated.go
Normal file
@@ -0,0 +1,106 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type DpiGroup struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
DPIappIDs []string `json:"dpiapp_ids,omitempty"` // [\d\w]+
|
||||
Enabled bool `json:"enabled"`
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
}
|
||||
|
||||
func (c *Client) listDpiGroup(site string) ([]DpiGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DpiGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/dpigroup", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getDpiGroup(site, id string) (*DpiGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DpiGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/dpigroup/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteDpiGroup(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/dpigroup/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createDpiGroup(site string, d *DpiGroup) (*DpiGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DpiGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/dpigroup", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateDpiGroup(site string, d *DpiGroup) (*DpiGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DpiGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/dpigroup/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
111
unifi/dynamic_dns.generated.go
Normal file
111
unifi/dynamic_dns.generated.go
Normal file
@@ -0,0 +1,111 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type DynamicDNS struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
CustomService string `json:"custom_service,omitempty"` // ^[^"' ]+$
|
||||
HostName string `json:"host_name,omitempty"` // ^[^"' ]+$
|
||||
Interface string `json:"interface,omitempty"` // wan|wan2
|
||||
Login string `json:"login,omitempty"` // ^[^"' ]+$
|
||||
Options []string `json:"options,omitempty"` // ^[^"' ]+$
|
||||
Server string `json:"server"` // ^[^"' ]+$|^$
|
||||
Service string `json:"service,omitempty"` // afraid|changeip|cloudflare|dnspark|dslreports|dyndns|easydns|googledomains|namecheap|noip|sitelutions|zoneedit|custom
|
||||
XPassword string `json:"x_password,omitempty"` // ^[^"' ]+$
|
||||
}
|
||||
|
||||
func (c *Client) listDynamicDNS(site string) ([]DynamicDNS, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DynamicDNS `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/dynamicdns", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getDynamicDNS(site, id string) (*DynamicDNS, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DynamicDNS `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/dynamicdns/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteDynamicDNS(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/dynamicdns/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createDynamicDNS(site string, d *DynamicDNS) (*DynamicDNS, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DynamicDNS `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/dynamicdns", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateDynamicDNS(site string, d *DynamicDNS) (*DynamicDNS, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []DynamicDNS `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/dynamicdns/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
106
unifi/firewall_group.generated.go
Normal file
106
unifi/firewall_group.generated.go
Normal file
@@ -0,0 +1,106 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type FirewallGroup struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
GroupMembers []string `json:"group_members,omitempty"`
|
||||
GroupType string `json:"group_type,omitempty"` // address-group|port-group|ipv6-address-group
|
||||
Name string `json:"name,omitempty"` // .{1,64}
|
||||
}
|
||||
|
||||
func (c *Client) listFirewallGroup(site string) ([]FirewallGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []FirewallGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/firewallgroup", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getFirewallGroup(site, id string) (*FirewallGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []FirewallGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/firewallgroup/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteFirewallGroup(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/firewallgroup/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createFirewallGroup(site string, d *FirewallGroup) (*FirewallGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []FirewallGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/firewallgroup", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateFirewallGroup(site string, d *FirewallGroup) (*FirewallGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []FirewallGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/firewallgroup/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
21
unifi/firewall_group.go
Normal file
21
unifi/firewall_group.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package unifi
|
||||
|
||||
func (c *Client) ListFirewallGroup(site string) ([]FirewallGroup, error) {
|
||||
return c.listFirewallGroup(site)
|
||||
}
|
||||
|
||||
func (c *Client) GetFirewallGroup(site, id string) (*FirewallGroup, error) {
|
||||
return c.getFirewallGroup(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) DeleteFirewallGroup(site, id string) error {
|
||||
return c.deleteFirewallGroup(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) CreateFirewallGroup(site string, d *FirewallGroup) (*FirewallGroup, error) {
|
||||
return c.createFirewallGroup(site, d)
|
||||
}
|
||||
|
||||
func (c *Client) UpdateFirewallGroup(site string, d *FirewallGroup) (*FirewallGroup, error) {
|
||||
return c.updateFirewallGroup(site, d)
|
||||
}
|
||||
142
unifi/firewall_rule.generated.go
Normal file
142
unifi/firewall_rule.generated.go
Normal file
@@ -0,0 +1,142 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type FirewallRule struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Action string `json:"action,omitempty"` // drop|reject|accept
|
||||
Contiguous bool `json:"contiguous"`
|
||||
DstAddress string `json:"dst_address,omitempty"`
|
||||
DstAddressIPV6 string `json:"dst_address_ipv6,omitempty"`
|
||||
DstFirewallgroupIDs []string `json:"dst_firewallgroup_ids,omitempty"` // [\d\w]+
|
||||
DstNetworkconfID string `json:"dst_networkconf_id"` // [\d\w]+|^$
|
||||
DstNetworkconfType string `json:"dst_networkconf_type,omitempty"` // ADDRv4|NETv4
|
||||
DstPort string `json:"dst_port,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
IcmpTypename string `json:"icmp_typename"` // ^$|communication-prohibited|destination-unreachable|echo-reply|echo-request|fragmentation-needed|host-precedence-violation|host-prohibited|host-redirect|host-unknown|host-unreachable|ip-header-bad|network-prohibited|network-redirect|network-unknown|network-unreachable|parameter-problem|port-unreachable|protocol-unreachable|redirect|required-option-missing|router-advertisement|router-solicitation|source-route-failed|timestamp-reply|timestamp-request|TOS-host-redirect|TOS-host-unreachable|TOS-network-redirect|TOS-network-unreachable|ttl-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit
|
||||
Icmpv6Typename string `json:"icmpv6_typename"` // ^$|address-unreachable|bad-header|communication-prohibited|destination-unreachable|echo-reply|echo-request|neighbor-advertisement|neighbor-solicitation|no-route|packet-too-big|parameter-problem|port-unreachable|redirect|router-advertisement|router-solicitation|time-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit|unknown-header-type|unknown-option
|
||||
IPSec string `json:"ipsec"` // match-ipsec|match-none|^$
|
||||
Logging bool `json:"logging"`
|
||||
Monthdays string `json:"monthdays"` // ^$|^(([1-9]|[12][0-9]|3[01])(,([1-9]|[12][0-9]|3[01])){0,30})$
|
||||
MonthdaysNegate bool `json:"monthdays_negate"`
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
Protocol string `json:"protocol"` // ^$|all|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|tcp_udp|ah|ax.25|dccp|ddp|egp|eigrp|encap|esp|etherip|fc|ggp|gre|hip|hmp|icmp|idpr-cmtp|idrp|igmp|igp|ip|ipcomp|ipencap|ipip|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|iso-tp4|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|pup|rdp|rohc|rspf|rsvp|sctp|shim6|skip|st|tcp|udp|udplite|vmtp|vrrp|wesp|xns-idp|xtp
|
||||
ProtocolMatchExcepted bool `json:"protocol_match_excepted"`
|
||||
ProtocolV6 string `json:"protocol_v6"` // ^$|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|ah|all|dccp|eigrp|esp|gre|icmpv6|ipcomp|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|rsvp|sctp|shim6|tcp|tcp_udp|udp|vrrp
|
||||
RuleIndex int `json:"rule_index,omitempty"` // 2[0-9]{3}|4[0-9]{3}
|
||||
Ruleset string `json:"ruleset,omitempty"` // WAN_IN|WAN_OUT|WAN_LOCAL|LAN_IN|LAN_OUT|LAN_LOCAL|GUEST_IN|GUEST_OUT|GUEST_LOCAL|WANv6_IN|WANv6_OUT|WANv6_LOCAL|LANv6_IN|LANv6_OUT|LANv6_LOCAL|GUESTv6_IN|GUESTv6_OUT|GUESTv6_LOCAL
|
||||
SrcAddress string `json:"src_address,omitempty"`
|
||||
SrcAddressIPV6 string `json:"src_address_ipv6,omitempty"`
|
||||
SrcFirewallgroupIDs []string `json:"src_firewallgroup_ids,omitempty"` // [\d\w]+
|
||||
SrcMACAddress string `json:"src_mac_address"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$
|
||||
SrcNetworkconfID string `json:"src_networkconf_id"` // [\d\w]+|^$
|
||||
SrcNetworkconfType string `json:"src_networkconf_type,omitempty"` // ADDRv4|NETv4
|
||||
SrcPort string `json:"src_port,omitempty"`
|
||||
Startdate string `json:"startdate"` // ^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$
|
||||
Starttime string `json:"starttime"` // ^$|^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$
|
||||
StateEstablished bool `json:"state_established"`
|
||||
StateInvalid bool `json:"state_invalid"`
|
||||
StateNew bool `json:"state_new"`
|
||||
StateRelated bool `json:"state_related"`
|
||||
Stopdate string `json:"stopdate"` // ^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$
|
||||
Stoptime string `json:"stoptime"` // ^$|^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$
|
||||
Utc bool `json:"utc"`
|
||||
Weekdays string `json:"weekdays"` // ^$|^((Mon|Tue|Wed|Thu|Fri|Sat|Sun)(,(Mon|Tue|Wed|Thu|Fri|Sat|Sun)){0,6})$
|
||||
WeekdaysNegate bool `json:"weekdays_negate"`
|
||||
}
|
||||
|
||||
func (c *Client) listFirewallRule(site string) ([]FirewallRule, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []FirewallRule `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/firewallrule", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getFirewallRule(site, id string) (*FirewallRule, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []FirewallRule `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/firewallrule/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteFirewallRule(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/firewallrule/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createFirewallRule(site string, d *FirewallRule) (*FirewallRule, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []FirewallRule `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/firewallrule", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateFirewallRule(site string, d *FirewallRule) (*FirewallRule, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []FirewallRule `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/firewallrule/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
21
unifi/firewall_rule.go
Normal file
21
unifi/firewall_rule.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package unifi
|
||||
|
||||
func (c *Client) ListFirewallRule(site string) ([]FirewallRule, error) {
|
||||
return c.listFirewallRule(site)
|
||||
}
|
||||
|
||||
func (c *Client) GetFirewallRule(site, id string) (*FirewallRule, error) {
|
||||
return c.getFirewallRule(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) DeleteFirewallRule(site, id string) error {
|
||||
return c.deleteFirewallRule(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) CreateFirewallRule(site string, d *FirewallRule) (*FirewallRule, error) {
|
||||
return c.createFirewallRule(site, d)
|
||||
}
|
||||
|
||||
func (c *Client) UpdateFirewallRule(site string, d *FirewallRule) (*FirewallRule, error) {
|
||||
return c.updateFirewallRule(site, d)
|
||||
}
|
||||
107
unifi/heat_map.generated.go
Normal file
107
unifi/heat_map.generated.go
Normal file
@@ -0,0 +1,107 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type HeatMap struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Description string `json:"description,omitempty"`
|
||||
MapID string `json:"map_id"`
|
||||
Name string `json:"name,omitempty"` // .*[^\s]+.*
|
||||
Type string `json:"type,omitempty"` // download|upload
|
||||
}
|
||||
|
||||
func (c *Client) listHeatMap(site string) ([]HeatMap, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HeatMap `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/heatmap", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getHeatMap(site, id string) (*HeatMap, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HeatMap `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/heatmap/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteHeatMap(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/heatmap/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createHeatMap(site string, d *HeatMap) (*HeatMap, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HeatMap `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/heatmap", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateHeatMap(site string, d *HeatMap) (*HeatMap, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HeatMap `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/heatmap/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
108
unifi/heat_map_point.generated.go
Normal file
108
unifi/heat_map_point.generated.go
Normal file
@@ -0,0 +1,108 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type HeatMapPoint struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
DownloadSpeed float64 `json:"download_speed,omitempty"`
|
||||
HeatmapID string `json:"heatmap_id"`
|
||||
UploadSpeed float64 `json:"upload_speed,omitempty"`
|
||||
X float64 `json:"x,omitempty"`
|
||||
Y float64 `json:"y,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listHeatMapPoint(site string) ([]HeatMapPoint, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HeatMapPoint `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/heatmappoint", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getHeatMapPoint(site, id string) (*HeatMapPoint, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HeatMapPoint `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/heatmappoint/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteHeatMapPoint(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/heatmappoint/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createHeatMapPoint(site string, d *HeatMapPoint) (*HeatMapPoint, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HeatMapPoint `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/heatmappoint", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateHeatMapPoint(site string, d *HeatMapPoint) (*HeatMapPoint, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HeatMapPoint `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/heatmappoint/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
106
unifi/hotspot_op.generated.go
Normal file
106
unifi/hotspot_op.generated.go
Normal file
@@ -0,0 +1,106 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type HotspotOp struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Name string `json:"name,omitempty"` // .{1,256}
|
||||
Note string `json:"note,omitempty"`
|
||||
XPassword string `json:"x_password,omitempty"` // .{1,256}
|
||||
}
|
||||
|
||||
func (c *Client) listHotspotOp(site string) ([]HotspotOp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HotspotOp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/hotspotop", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getHotspotOp(site, id string) (*HotspotOp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HotspotOp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/hotspotop/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteHotspotOp(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/hotspotop/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createHotspotOp(site string, d *HotspotOp) (*HotspotOp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HotspotOp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/hotspotop", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateHotspotOp(site string, d *HotspotOp) (*HotspotOp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HotspotOp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/hotspotop/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
132
unifi/hotspot_package.generated.go
Normal file
132
unifi/hotspot_package.generated.go
Normal file
@@ -0,0 +1,132 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type HotspotPackage struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Amount float64 `json:"amount,omitempty"`
|
||||
ChargedAs string `json:"charged_as,omitempty"`
|
||||
Currency string `json:"currency,omitempty"` // [A-Z]{3}
|
||||
CustomPaymentFieldsEnabled bool `json:"custom_payment_fields_enabled"`
|
||||
Hours int `json:"hours,omitempty"`
|
||||
Index int `json:"index,omitempty"`
|
||||
LimitDown int `json:"limit_down,omitempty"`
|
||||
LimitOverwrite bool `json:"limit_overwrite"`
|
||||
LimitQuota int `json:"limit_quota,omitempty"`
|
||||
LimitUp int `json:"limit_up,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
PaymentFieldsAddressEnabled bool `json:"payment_fields_address_enabled"`
|
||||
PaymentFieldsAddressRequired bool `json:"payment_fields_address_required"`
|
||||
PaymentFieldsCityEnabled bool `json:"payment_fields_city_enabled"`
|
||||
PaymentFieldsCityRequired bool `json:"payment_fields_city_required"`
|
||||
PaymentFieldsCountryDefault string `json:"payment_fields_country_default,omitempty"`
|
||||
PaymentFieldsCountryEnabled bool `json:"payment_fields_country_enabled"`
|
||||
PaymentFieldsCountryRequired bool `json:"payment_fields_country_required"`
|
||||
PaymentFieldsEmailEnabled bool `json:"payment_fields_email_enabled"`
|
||||
PaymentFieldsEmailRequired bool `json:"payment_fields_email_required"`
|
||||
PaymentFieldsFirstNameEnabled bool `json:"payment_fields_first_name_enabled"`
|
||||
PaymentFieldsFirstNameRequired bool `json:"payment_fields_first_name_required"`
|
||||
PaymentFieldsLastNameEnabled bool `json:"payment_fields_last_name_enabled"`
|
||||
PaymentFieldsLastNameRequired bool `json:"payment_fields_last_name_required"`
|
||||
PaymentFieldsStateEnabled bool `json:"payment_fields_state_enabled"`
|
||||
PaymentFieldsStateRequired bool `json:"payment_fields_state_required"`
|
||||
PaymentFieldsZipEnabled bool `json:"payment_fields_zip_enabled"`
|
||||
PaymentFieldsZipRequired bool `json:"payment_fields_zip_required"`
|
||||
TrialReset float64 `json:"trial_reset,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listHotspotPackage(site string) ([]HotspotPackage, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HotspotPackage `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/hotspotpackage", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getHotspotPackage(site, id string) (*HotspotPackage, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HotspotPackage `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/hotspotpackage/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteHotspotPackage(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/hotspotpackage/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createHotspotPackage(site string, d *HotspotPackage) (*HotspotPackage, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HotspotPackage `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/hotspotpackage", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateHotspotPackage(site string, d *HotspotPackage) (*HotspotPackage, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []HotspotPackage `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/hotspotpackage/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
116
unifi/map.generated.go
Normal file
116
unifi/map.generated.go
Normal file
@@ -0,0 +1,116 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type Map struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Lat string `json:"lat,omitempty"` // ^([-]?[\d]+[.]?[\d]*([eE][-+]?[\d]+)?)$
|
||||
Lng string `json:"lng,omitempty"` // ^([-]?[\d]+[.]?[\d]*([eE][-+]?[\d]+)?)$
|
||||
MapTypeID string `json:"mapTypeId"` // satellite|roadmap|hybrid|terrain
|
||||
Name string `json:"name,omitempty"`
|
||||
OffsetLeft float64 `json:"offset_left,omitempty"`
|
||||
OffsetTop float64 `json:"offset_top,omitempty"`
|
||||
Opacity float64 `json:"opacity,omitempty"` // ^(0(\.[\d]{1,2})?|1)$|^$
|
||||
Selected bool `json:"selected"`
|
||||
Tilt int `json:"tilt,omitempty"`
|
||||
Type string `json:"type,omitempty"` // designerMap|imageMap|googleMap
|
||||
Unit string `json:"unit,omitempty"` // m|f
|
||||
Upp float64 `json:"upp,omitempty"`
|
||||
Zoom int `json:"zoom,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listMap(site string) ([]Map, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Map `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/map", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getMap(site, id string) (*Map, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Map `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/map/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteMap(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/map/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createMap(site string, d *Map) (*Map, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Map `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/map", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateMap(site string, d *Map) (*Map, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Map `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/map/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
104
unifi/media_file.generated.go
Normal file
104
unifi/media_file.generated.go
Normal file
@@ -0,0 +1,104 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type MediaFile struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listMediaFile(site string) ([]MediaFile, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []MediaFile `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/mediafile", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getMediaFile(site, id string) (*MediaFile, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []MediaFile `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/mediafile/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteMediaFile(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/mediafile/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createMediaFile(site string, d *MediaFile) (*MediaFile, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []MediaFile `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/mediafile", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateMediaFile(site string, d *MediaFile) (*MediaFile, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []MediaFile `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/mediafile/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
239
unifi/network.generated.go
Normal file
239
unifi/network.generated.go
Normal file
@@ -0,0 +1,239 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type Network struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
DHCPRelayEnabled bool `json:"dhcp_relay_enabled"`
|
||||
DHCPDBootEnabled bool `json:"dhcpd_boot_enabled"`
|
||||
DHCPDBootFilename string `json:"dhcpd_boot_filename,omitempty"` // .{1,256}
|
||||
DHCPDBootServer string `json:"dhcpd_boot_server"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|[a-zA-Z0-9-]{1,63}|^$
|
||||
DHCPDDNS1 string `json:"dhcpd_dns_1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDDNS2 string `json:"dhcpd_dns_2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDDNS3 string `json:"dhcpd_dns_3"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDDNS4 string `json:"dhcpd_dns_4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDDNSEnabled bool `json:"dhcpd_dns_enabled"`
|
||||
DHCPDEnabled bool `json:"dhcpd_enabled"`
|
||||
DHCPDGateway string `json:"dhcpd_gateway"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDGatewayEnabled bool `json:"dhcpd_gateway_enabled"`
|
||||
DHCPDIP1 string `json:"dhcpd_ip_1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDIP2 string `json:"dhcpd_ip_2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDIP3 string `json:"dhcpd_ip_3"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDLeaseTime int `json:"dhcpd_leasetime,omitempty"`
|
||||
DHCPDMAC1 string `json:"dhcpd_mac_1,omitempty"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
|
||||
DHCPDMAC2 string `json:"dhcpd_mac_2,omitempty"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
|
||||
DHCPDMAC3 string `json:"dhcpd_mac_3,omitempty"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
|
||||
DHCPDNtp1 string `json:"dhcpd_ntp_1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDNtp2 string `json:"dhcpd_ntp_2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDNtpEnabled bool `json:"dhcpd_ntp_enabled"`
|
||||
DHCPDStart string `json:"dhcpd_start"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDStop string `json:"dhcpd_stop"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDTFTPServer string `json:"dhcpd_tftp_server,omitempty"`
|
||||
DHCPDTimeOffset int `json:"dhcpd_time_offset,omitempty"` // ^0$|^-?([1-9]([0-9]{1,3})?|[1-7][0-9]{4}|[8][0-5][0-9]{3}|86[0-3][0-9]{2}|86400)$
|
||||
DHCPDTimeOffsetEnabled bool `json:"dhcpd_time_offset_enabled"`
|
||||
DHCPDUnifiController string `json:"dhcpd_unifi_controller"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDWins1 string `json:"dhcpd_wins_1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDWins2 string `json:"dhcpd_wins_2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDWinsEnabled bool `json:"dhcpd_wins_enabled"`
|
||||
DHCPDWPAdUrl string `json:"dhcpd_wpad_url,omitempty"`
|
||||
DHCPDV6DNS1 string `json:"dhcpdv6_dns_1,omitempty"`
|
||||
DHCPDV6DNS2 string `json:"dhcpdv6_dns_2,omitempty"`
|
||||
DHCPDV6DNS3 string `json:"dhcpdv6_dns_3,omitempty"`
|
||||
DHCPDV6DNS4 string `json:"dhcpdv6_dns_4,omitempty"`
|
||||
DHCPDV6DNSAuto bool `json:"dhcpdv6_dns_auto"`
|
||||
DHCPDV6Enabled bool `json:"dhcpdv6_enabled"`
|
||||
DHCPDV6LeaseTime int `json:"dhcpdv6_leasetime,omitempty"`
|
||||
DHCPDV6Start string `json:"dhcpdv6_start,omitempty"`
|
||||
DHCPDV6Stop string `json:"dhcpdv6_stop,omitempty"`
|
||||
DHCPguardEnabled bool `json:"dhcpguard_enabled"`
|
||||
DomainName string `json:"domain_name,omitempty"` // (?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^$|[a-zA-Z0-9-]{1,63}
|
||||
DPIEnabled bool `json:"dpi_enabled"`
|
||||
DPIgroupID string `json:"dpigroup_id"` // [\d\w]+|^$
|
||||
Enabled bool `json:"enabled"`
|
||||
ExposedToSiteVPN bool `json:"exposed_to_site_vpn"`
|
||||
IGMPFastleave bool `json:"igmp_fastleave"`
|
||||
IGMPGroupmembership int `json:"igmp_groupmembership,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-2][0-9]{3}|3[0-5][0-9]{2}|3600|^$
|
||||
IGMPMaxresponse int `json:"igmp_maxresponse,omitempty"` // [1-9]|1[0-9]|2[0-5]|^$
|
||||
IGMPMcrtrexpiretime int `json:"igmp_mcrtrexpiretime,omitempty"` // [0-9]|[1-9][0-9]{1,2}|[1-2][0-9]{3}|3[0-5][0-9]{2}|3600|^$
|
||||
IGMPQuerier string `json:"igmp_querier"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
IGMPSnooping bool `json:"igmp_snooping"`
|
||||
IGMPSupression bool `json:"igmp_supression"`
|
||||
IPSubnet string `json:"ip_subnet,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|30)$
|
||||
IPSecDhGroup int `json:"ipsec_dh_group,omitempty"` // 2|5|14|15|16|19|20|21|25|26
|
||||
IPSecDynamicRouting bool `json:"ipsec_dynamic_routing"`
|
||||
IPSecEncryption string `json:"ipsec_encryption,omitempty"` // aes128|aes192|aes256|3des
|
||||
IPSecEspDhGroup int `json:"ipsec_esp_dh_group,omitempty"` // 1|2|5|14|15|16|17|18
|
||||
IPSecHash string `json:"ipsec_hash,omitempty"` // sha1|md5|sha256|sha384|sha512
|
||||
IPSecIkeDhGroup int `json:"ipsec_ike_dh_group,omitempty"` // 1|2|5|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32
|
||||
IPSecInterface string `json:"ipsec_interface,omitempty"` // wan|wan2
|
||||
IPSecKeyExchange string `json:"ipsec_key_exchange,omitempty"` // ikev1|ikev2
|
||||
IPSecLocalIP string `json:"ipsec_local_ip,omitempty"` // ^any$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||
IPSecPeerIP string `json:"ipsec_peer_ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||
IPSecPfs bool `json:"ipsec_pfs"`
|
||||
IPSecProfile string `json:"ipsec_profile,omitempty"` // customized|azure_dynamic|azure_static
|
||||
IPV6InterfaceType string `json:"ipv6_interface_type,omitempty"` // static|pd|none
|
||||
IPV6PDInterface string `json:"ipv6_pd_interface,omitempty"` // wan|wan2
|
||||
IPV6PDPrefixid string `json:"ipv6_pd_prefixid"` // ^$|[a-fA-F0-9]{1,4}
|
||||
IPV6PDStart string `json:"ipv6_pd_start,omitempty"`
|
||||
IPV6PDStop string `json:"ipv6_pd_stop,omitempty"`
|
||||
IPV6RaEnabled bool `json:"ipv6_ra_enabled"`
|
||||
IPV6RaPreferredLifetime int `json:"ipv6_ra_preferred_lifetime,omitempty"` // ^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[12][0-9]{7}|30[0-9]{6}|31[0-4][0-9]{5}|315[0-2][0-9]{4}|3153[0-5][0-9]{3}|31536000)$|^$
|
||||
IPV6RaPriority string `json:"ipv6_ra_priority,omitempty"` // high|medium|low
|
||||
IPV6RaValidLifetime int `json:"ipv6_ra_valid_lifetime,omitempty"` // ^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[12][0-9]{7}|30[0-9]{6}|31[0-4][0-9]{5}|315[0-2][0-9]{4}|3153[0-5][0-9]{3}|31536000)$|^$
|
||||
IPV6Subnet string `json:"ipv6_subnet,omitempty"`
|
||||
IsNAT bool `json:"is_nat"`
|
||||
L2TpInterface string `json:"l2tp_interface,omitempty"` // wan|wan2
|
||||
LteLanEnabled bool `json:"lte_lan_enabled"`
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
NATOutboundIP string `json:"nat_outbound_ip,omitempty"`
|
||||
NetworkGroup string `json:"networkgroup,omitempty"` // LAN[2-8]?
|
||||
OpenVPNLocalAddress string `json:"openvpn_local_address,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||
OpenVPNLocalPort int `json:"openvpn_local_port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$
|
||||
OpenVPNMode string `json:"openvpn_mode,omitempty"` // site-to-site|client|server
|
||||
OpenVPNRemoteAddress string `json:"openvpn_remote_address,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||
OpenVPNRemoteHost string `json:"openvpn_remote_host,omitempty"` // [^\"\' ]+|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||
OpenVPNRemotePort int `json:"openvpn_remote_port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$
|
||||
PptpcRequireMppe bool `json:"pptpc_require_mppe"`
|
||||
PptpcRouteDistance int `json:"pptpc_route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
|
||||
PptpcServerIP string `json:"pptpc_server_ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^[a-zA-Z0-9-]{1,63}$
|
||||
PptpcUsername string `json:"pptpc_username,omitempty"` // [^\"\' ]+
|
||||
Priority int `json:"priority,omitempty"` // [1-4]
|
||||
Purpose string `json:"purpose,omitempty"` // corporate|guest|remote-user-vpn|site-vpn|vlan-only|vpn-client|wan
|
||||
RADIUSprofileID string `json:"radiusprofile_id"`
|
||||
RemoteSiteID string `json:"remote_site_id"`
|
||||
RemoteSiteSubnets []string `json:"remote_site_subnets,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|30)$|^$
|
||||
RemoteVPNSubnets []string `json:"remote_vpn_subnets,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|30)$|^$
|
||||
ReportWANEvent bool `json:"report_wan_event"`
|
||||
RequireMschapv2 bool `json:"require_mschapv2"`
|
||||
RouteDistance int `json:"route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
|
||||
UpnpLanEnabled bool `json:"upnp_lan_enabled"`
|
||||
UserGroupID string `json:"usergroup_id"`
|
||||
VLAN int `json:"vlan,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$
|
||||
VLANEnabled bool `json:"vlan_enabled"`
|
||||
VPNClientDefaultRoute bool `json:"vpn_client_default_route"`
|
||||
VPNClientPullDNS bool `json:"vpn_client_pull_dns"`
|
||||
VPNType string `json:"vpn_type,omitempty"` // auto|ipsec-vpn|openvpn-vpn|pptp-client|l2tp-server|pptp-server
|
||||
WANDHCPv6PDSize int `json:"wan_dhcpv6_pd_size,omitempty"` // ^(4[89]|5[0-9]|6[0-4])$|^$
|
||||
WANDNS1 string `json:"wan_dns1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
WANDNS2 string `json:"wan_dns2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
WANDNS3 string `json:"wan_dns3"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
WANDNS4 string `json:"wan_dns4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
WANEgressQOS int `json:"wan_egress_qos,omitempty"` // [1-7]|^$
|
||||
WANGateway string `json:"wan_gateway"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
WANGatewayV6 string `json:"wan_gateway_v6"` // ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
|
||||
WANIP string `json:"wan_ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||
WANIPV6 string `json:"wan_ipv6"` // ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
|
||||
WANLoadBalanceType string `json:"wan_load_balance_type,omitempty"` // failover-only|weighted
|
||||
WANLoadBalanceWeight int `json:"wan_load_balance_weight,omitempty"` // [1-9]|[1-9][0-9]
|
||||
WANNetmask string `json:"wan_netmask,omitempty"` // ^((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0)|255\.(0|128|192|224|240|248|252|254)))))$
|
||||
WANNetworkGroup string `json:"wan_networkgroup,omitempty"` // WAN[2]?|WAN_LTE_FAILOVER
|
||||
WANPrefixlen int `json:"wan_prefixlen,omitempty"` // ^([1-9]|[1-8][0-9]|9[0-9]|1[01][0-9]|12[0-8])$|^$
|
||||
WANSmartqDownRate int `json:"wan_smartq_down_rate,omitempty"` // [0-9]{1,6}|1000000
|
||||
WANSmartqEnabled bool `json:"wan_smartq_enabled"`
|
||||
WANSmartqUpRate int `json:"wan_smartq_up_rate,omitempty"` // [0-9]{1,6}|1000000
|
||||
WANType string `json:"wan_type,omitempty"` // disabled|dhcp|static|pppoe
|
||||
WANTypeV6 string `json:"wan_type_v6,omitempty"` // disabled|dhcpv6|static
|
||||
WANUsername string `json:"wan_username,omitempty"` // [^"' ]+
|
||||
WANVLAN int `json:"wan_vlan,omitempty"` // [0-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-4]|^$
|
||||
WANVLANEnabled bool `json:"wan_vlan_enabled"`
|
||||
XIPSecPreSharedKey string `json:"x_ipsec_pre_shared_key,omitempty"` // [^\"\' ]+
|
||||
XOpenVPNSharedSecretKey string `json:"x_openvpn_shared_secret_key,omitempty"` // [0-9A-Fa-f]{512}
|
||||
XPptpcPassword string `json:"x_pptpc_password,omitempty"` // [^\"\' ]+
|
||||
XWANPassword string `json:"x_wan_password,omitempty"` // [^"' ]+
|
||||
}
|
||||
|
||||
func (c *Client) listNetwork(site string) ([]Network, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Network `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/networkconf", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getNetwork(site, id string) (*Network, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Network `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/networkconf/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteNetwork(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/networkconf/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createNetwork(site string, d *Network) (*Network, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Network `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/networkconf", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateNetwork(site string, d *Network) (*Network, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Network `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/networkconf/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
57
unifi/network.go
Normal file
57
unifi/network.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (n *Network) UnmarshalJSON(b []byte) error {
|
||||
type Alias Network
|
||||
aux := &struct {
|
||||
VLAN json.Number `json:"vlan"`
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(n),
|
||||
}
|
||||
err := json.Unmarshal(b, &aux)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
n.VLAN = 0
|
||||
if aux.VLAN.String() != "" {
|
||||
vlan, err := aux.VLAN.Int64()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
n.VLAN = int(vlan)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) DeleteNetwork(site, id, name string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/networkconf/%s", site, id), struct {
|
||||
Name string `json:"name"`
|
||||
}{
|
||||
Name: name,
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) ListNetwork(site string) ([]Network, error) {
|
||||
return c.listNetwork(site)
|
||||
}
|
||||
|
||||
func (c *Client) GetNetwork(site, id string) (*Network, error) {
|
||||
return c.getNetwork(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) CreateNetwork(site string, d *Network) (*Network, error) {
|
||||
return c.createNetwork(site, d)
|
||||
}
|
||||
|
||||
func (c *Client) UpdateNetwork(site string, d *Network) (*Network, error) {
|
||||
return c.updateNetwork(site, d)
|
||||
}
|
||||
136
unifi/port_conf.generated.go
Normal file
136
unifi/port_conf.generated.go
Normal file
@@ -0,0 +1,136 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type PortConf struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Autoneg bool `json:"autoneg"`
|
||||
Dot1XCtrl string `json:"dot1x_ctrl,omitempty"` // auto|force_authorized|force_unauthorized|mac_based|multi_host
|
||||
EgressRateLimitKbps int `json:"egress_rate_limit_kbps,omitempty"` // 6[4-9]|[7-9][0-9]|[1-9][0-9]{2,6}
|
||||
EgressRateLimitKbpsEnabled bool `json:"egress_rate_limit_kbps_enabled"`
|
||||
Forward string `json:"forward,omitempty"` // all|native|customize|disabled
|
||||
FullDuplex bool `json:"full_duplex"`
|
||||
Isolation bool `json:"isolation"`
|
||||
LldpmedEnabled bool `json:"lldpmed_enabled"`
|
||||
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled"`
|
||||
Name string `json:"name,omitempty"`
|
||||
NATiveNetworkconfID string `json:"native_networkconf_id"`
|
||||
OpMode string `json:"op_mode,omitempty"` // switch
|
||||
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
|
||||
PortSecurityEnabled bool `json:"port_security_enabled"`
|
||||
PortSecurityMACAddress []string `json:"port_security_mac_address,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
|
||||
PriorityQueue1Level int `json:"priority_queue1_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
PriorityQueue2Level int `json:"priority_queue2_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
PriorityQueue3Level int `json:"priority_queue3_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
PriorityQueue4Level int `json:"priority_queue4_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
Speed int `json:"speed,omitempty"` // 10|100|1000|2500|5000|10000|20000|25000|40000|50000|100000
|
||||
StormctrlBroadcastastEnabled bool `json:"stormctrl_bcast_enabled"`
|
||||
StormctrlBroadcastastLevel int `json:"stormctrl_bcast_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
StormctrlBroadcastastRate int `json:"stormctrl_bcast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
|
||||
StormctrlMcastEnabled bool `json:"stormctrl_mcast_enabled"`
|
||||
StormctrlMcastLevel int `json:"stormctrl_mcast_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
StormctrlMcastRate int `json:"stormctrl_mcast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
|
||||
StormctrlType string `json:"stormctrl_type,omitempty"` // level|rate
|
||||
StormctrlUcastEnabled bool `json:"stormctrl_ucast_enabled"`
|
||||
StormctrlUcastLevel int `json:"stormctrl_ucast_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
StormctrlUcastRate int `json:"stormctrl_ucast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
|
||||
StpPortMode bool `json:"stp_port_mode"`
|
||||
TaggedNetworkconfIDs []string `json:"tagged_networkconf_ids,omitempty"`
|
||||
VoiceNetworkconfID string `json:"voice_networkconf_id"`
|
||||
}
|
||||
|
||||
func (c *Client) listPortConf(site string) ([]PortConf, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []PortConf `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/portconf", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getPortConf(site, id string) (*PortConf, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []PortConf `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/portconf/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deletePortConf(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/portconf/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createPortConf(site string, d *PortConf) (*PortConf, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []PortConf `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/portconf", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updatePortConf(site string, d *PortConf) (*PortConf, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []PortConf `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/portconf/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
112
unifi/port_forward.generated.go
Normal file
112
unifi/port_forward.generated.go
Normal file
@@ -0,0 +1,112 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type PortForward struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
DstPort string `json:"dst_port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
|
||||
Enabled bool `json:"enabled"`
|
||||
Fwd string `json:"fwd,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||
FwdPort string `json:"fwd_port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
|
||||
Log bool `json:"log"`
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
PfwdInterface string `json:"pfwd_interface,omitempty"` // wan|wan2|both
|
||||
Proto string `json:"proto,omitempty"` // tcp_udp|tcp|udp
|
||||
Src string `json:"src,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])-(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([0-9]|[1-2][0-9]|3[0-2])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])-(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([0-9]|[1-2][0-9]|3[0-2])$|^any$
|
||||
}
|
||||
|
||||
func (c *Client) listPortForward(site string) ([]PortForward, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []PortForward `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/portforward", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getPortForward(site, id string) (*PortForward, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []PortForward `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/portforward/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deletePortForward(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/portforward/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createPortForward(site string, d *PortForward) (*PortForward, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []PortForward `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/portforward", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updatePortForward(site string, d *PortForward) (*PortForward, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []PortForward `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/portforward/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
21
unifi/port_forward.go
Normal file
21
unifi/port_forward.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package unifi
|
||||
|
||||
func (c *Client) ListPortForward(site string) ([]PortForward, error) {
|
||||
return c.listPortForward(site)
|
||||
}
|
||||
|
||||
func (c *Client) GetPortForward(site, id string) (*PortForward, error) {
|
||||
return c.getPortForward(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) DeletePortForward(site, id string) error {
|
||||
return c.deletePortForward(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) CreatePortForward(site string, d *PortForward) (*PortForward, error) {
|
||||
return c.createPortForward(site, d)
|
||||
}
|
||||
|
||||
func (c *Client) UpdatePortForward(site string, d *PortForward) (*PortForward, error) {
|
||||
return c.updatePortForward(site, d)
|
||||
}
|
||||
111
unifi/routing.generated.go
Normal file
111
unifi/routing.generated.go
Normal file
@@ -0,0 +1,111 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type Routing struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
StaticRouteDistance int `json:"static-route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
|
||||
StaticRouteInterface string `json:"static-route_interface"` // WAN1|WAN2|[\d\w]+|^$
|
||||
StaticRouteNetwork string `json:"static-route_network,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|3[0-2])$|^([a-fA-F0-9:]+\/(([1-9]|[1-8][0-9]|9[0-9]|1[01][0-9]|12[0-8])))$
|
||||
StaticRouteNexthop string `json:"static-route_nexthop"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^([a-fA-F0-9:]+)$|^$
|
||||
StaticRouteType string `json:"static-route_type,omitempty"` // nexthop-route|interface-route|blackhole
|
||||
Type string `json:"type,omitempty"` // static-route
|
||||
}
|
||||
|
||||
func (c *Client) listRouting(site string) ([]Routing, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Routing `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/routing", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getRouting(site, id string) (*Routing, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Routing `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/routing/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteRouting(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/routing/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createRouting(site string, d *Routing) (*Routing, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Routing `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/routing", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateRouting(site string, d *Routing) (*Routing, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Routing `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/routing/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
118
unifi/setting.go
Normal file
118
unifi/setting.go
Normal file
@@ -0,0 +1,118 @@
|
||||
package unifi
|
||||
|
||||
import "fmt"
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type Setting struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
Key string `json:"key"`
|
||||
}
|
||||
|
||||
func (s *Setting) newFields() (interface{}, error) {
|
||||
switch s.Key {
|
||||
case "auto_speedtest":
|
||||
return &SettingAutoSpeedtest{}, nil
|
||||
case "baresip":
|
||||
return &SettingBaresip{}, nil
|
||||
case "broadcast":
|
||||
return &SettingBroadcast{}, nil
|
||||
case "connectivity":
|
||||
return &SettingConnectivity{}, nil
|
||||
case "country":
|
||||
return &SettingCountry{}, nil
|
||||
case "dpi":
|
||||
return &SettingDpi{}, nil
|
||||
case "element_adopt":
|
||||
return &SettingElementAdopt{}, nil
|
||||
case "guest_access":
|
||||
return &SettingGuestAccess{}, nil
|
||||
// case "ips":
|
||||
// return &SettingI
|
||||
case "lcm":
|
||||
return &SettingLcm{}, nil
|
||||
case "locale":
|
||||
return &SettingLocale{}, nil
|
||||
case "mgmt":
|
||||
return &SettingMgmt{}, nil
|
||||
case "network_optimization":
|
||||
return &SettingNetworkOptimization{}, nil
|
||||
case "ntp":
|
||||
return &SettingNtp{}, nil
|
||||
case "porta":
|
||||
return &SettingPorta{}, nil
|
||||
case "provider_capabilities":
|
||||
return &SettingProviderCapabilities{}, nil
|
||||
case "radio_ai":
|
||||
return &SettingRadioAi{}, nil
|
||||
case "radius":
|
||||
return &SettingRadius{}, nil
|
||||
case "rsyslogd":
|
||||
return &SettingRsyslogd{}, nil
|
||||
case "snmp":
|
||||
return &SettingSnmp{}, nil
|
||||
case "super_cloudaccess":
|
||||
return &SettingSuperCloudaccess{}, nil
|
||||
case "super_events":
|
||||
return &SettingSuperEvents{}, nil
|
||||
case "super_fwupdate":
|
||||
return &SettingSuperFwupdate{}, nil
|
||||
case "super_identity":
|
||||
return &SettingSuperIdentity{}, nil
|
||||
case "super_mail":
|
||||
return &SettingSuperMail{}, nil
|
||||
case "super_mgmt":
|
||||
return &SettingSuperMgmt{}, nil
|
||||
case "super_sdn":
|
||||
return &SettingSuperSdn{}, nil
|
||||
case "super_smtp":
|
||||
return &SettingSuperSmtp{}, nil
|
||||
case "usg":
|
||||
return &SettingUsg{}, nil
|
||||
case "usw":
|
||||
return &SettingUsw{}, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("unexpected key %q", s.Key)
|
||||
}
|
||||
|
||||
func (c *Client) GetSetting(site, key string) (*Setting, interface{}, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []json.RawMessage `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/get/setting", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var raw json.RawMessage
|
||||
var setting *Setting
|
||||
for _, d := range respBody.Data {
|
||||
err = json.Unmarshal(d, &setting)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
if setting.Key == key {
|
||||
raw = d
|
||||
break
|
||||
}
|
||||
}
|
||||
if setting == nil {
|
||||
return nil, nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
fields, err := setting.newFields()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(raw, &fields)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return setting, fields, nil
|
||||
}
|
||||
24
unifi/setting_auto_speedtest.generated.go
Normal file
24
unifi/setting_auto_speedtest.generated.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingAutoSpeedtest struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
Interval int `json:"interval,omitempty"` // ^(1[2-9]|[2-9][0-9]|[1-9][0-9]{2,3})$
|
||||
}
|
||||
26
unifi/setting_baresip.generated.go
Normal file
26
unifi/setting_baresip.generated.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingBaresip struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
OutboundProxy string `json:"outbound_proxy,omitempty"`
|
||||
PackageUrl string `json:"package_url,omitempty"`
|
||||
Server string `json:"server,omitempty"`
|
||||
}
|
||||
28
unifi/setting_broadcast.generated.go
Normal file
28
unifi/setting_broadcast.generated.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingBroadcast struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
SoundAfterEnabled bool `json:"sound_after_enabled"`
|
||||
SoundAfterResource string `json:"sound_after_resource,omitempty"`
|
||||
SoundAfterType string `json:"sound_after_type,omitempty"` // sample|media
|
||||
SoundBeforeEnabled bool `json:"sound_before_enabled"`
|
||||
SoundBeforeResource string `json:"sound_before_resource,omitempty"`
|
||||
SoundBeforeType string `json:"sound_before_type,omitempty"` // sample|media
|
||||
}
|
||||
28
unifi/setting_connectivity.generated.go
Normal file
28
unifi/setting_connectivity.generated.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingConnectivity struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
EnableIsolatedWLAN bool `json:"enable_isolated_wlan"`
|
||||
Enabled bool `json:"enabled"`
|
||||
UplinkHost string `json:"uplink_host,omitempty"`
|
||||
UplinkType string `json:"uplink_type,omitempty"`
|
||||
XMeshEssid string `json:"x_mesh_essid,omitempty"`
|
||||
XMeshPsk string `json:"x_mesh_psk,omitempty"`
|
||||
}
|
||||
23
unifi/setting_country.generated.go
Normal file
23
unifi/setting_country.generated.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingCountry struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Code int `json:"code,omitempty"`
|
||||
}
|
||||
24
unifi/setting_dpi.generated.go
Normal file
24
unifi/setting_dpi.generated.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingDpi struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
FingerprintingEnabled bool `json:"fingerprintingEnabled"`
|
||||
}
|
||||
25
unifi/setting_element_adopt.generated.go
Normal file
25
unifi/setting_element_adopt.generated.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingElementAdopt struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
XElementEssid string `json:"x_element_essid,omitempty"`
|
||||
XElementPsk string `json:"x_element_psk,omitempty"`
|
||||
}
|
||||
110
unifi/setting_guest_access.generated.go
Normal file
110
unifi/setting_guest_access.generated.go
Normal file
@@ -0,0 +1,110 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingGuestAccess struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
AllowedSubnet string `json:"allowed_subnet_,omitempty"`
|
||||
Auth string `json:"auth,omitempty"` // none|password|hotspot|facebook_wifi|custom
|
||||
AuthorizeUseSandbox bool `json:"authorize_use_sandbox"`
|
||||
CustomIP string `json:"custom_ip"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
EcEnabled bool `json:"ec_enabled"`
|
||||
Expire string `json:"expire,omitempty"` // [\d]+|custom
|
||||
ExpireNumber int `json:"expire_number,omitempty"` // ^[1-9][0-9]{0,5}|1000000$
|
||||
ExpireUnit int `json:"expire_unit,omitempty"` // 1|60|1440
|
||||
FacebookAppID string `json:"facebook_app_id"`
|
||||
FacebookEnabled bool `json:"facebook_enabled"`
|
||||
FacebookScopeEmail bool `json:"facebook_scope_email"`
|
||||
FacebookWifiBlockHttps bool `json:"facebook_wifi_block_https"`
|
||||
FacebookWifiGwID string `json:"facebook_wifi_gw_id"`
|
||||
FacebookWifiGwName string `json:"facebook_wifi_gw_name,omitempty"`
|
||||
Gateway string `json:"gateway,omitempty"` // paypal|stripe|authorize|quickpay|merchantwarrior|ippay
|
||||
GoogleClientID string `json:"google_client_id"`
|
||||
GoogleDomain string `json:"google_domain,omitempty"`
|
||||
GoogleEnabled bool `json:"google_enabled"`
|
||||
GoogleScopeEmail bool `json:"google_scope_email"`
|
||||
IPpayUseSandbox bool `json:"ippay_use_sandbox"`
|
||||
MerchantwarriorUseSandbox bool `json:"merchantwarrior_use_sandbox"`
|
||||
PaymentEnabled bool `json:"payment_enabled"`
|
||||
PaypalUseSandbox bool `json:"paypal_use_sandbox"`
|
||||
PortalCustomized bool `json:"portal_customized"`
|
||||
PortalCustomizedBgColor string `json:"portal_customized_bg_color"` // ^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$
|
||||
PortalCustomizedBgImageEnabled bool `json:"portal_customized_bg_image_enabled"`
|
||||
PortalCustomizedBgImageFilename string `json:"portal_customized_bg_image_filename,omitempty"`
|
||||
PortalCustomizedBgImageTile bool `json:"portal_customized_bg_image_tile"`
|
||||
PortalCustomizedBoxColor string `json:"portal_customized_box_color"` // ^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$
|
||||
PortalCustomizedBoxLinkColor string `json:"portal_customized_box_link_color"` // ^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$
|
||||
PortalCustomizedBoxOpacity int `json:"portal_customized_box_opacity,omitempty"` // ^[1-9][0-9]?$|^100$|^$
|
||||
PortalCustomizedBoxTextColor string `json:"portal_customized_box_text_color"` // ^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$
|
||||
PortalCustomizedButtonColor string `json:"portal_customized_button_color"` // ^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$
|
||||
PortalCustomizedButtonTextColor string `json:"portal_customized_button_text_color"` // ^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$
|
||||
PortalCustomizedLanguages []string `json:"portal_customized_languages,omitempty"` // ^[a-z]{2}(_[A-Z]{2})*$
|
||||
PortalCustomizedLinkColor string `json:"portal_customized_link_color"` // ^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$
|
||||
PortalCustomizedLogoEnabled bool `json:"portal_customized_logo_enabled"`
|
||||
PortalCustomizedLogoFilename string `json:"portal_customized_logo_filename,omitempty"`
|
||||
PortalCustomizedTextColor string `json:"portal_customized_text_color"` // ^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$
|
||||
PortalCustomizedTitle string `json:"portal_customized_title,omitempty"`
|
||||
PortalCustomizedTos string `json:"portal_customized_tos,omitempty"`
|
||||
PortalCustomizedTosEnabled bool `json:"portal_customized_tos_enabled"`
|
||||
PortalCustomizedUnsplashAuthorName string `json:"portal_customized_unsplash_author_name,omitempty"`
|
||||
PortalCustomizedUnsplashAuthorUsername string `json:"portal_customized_unsplash_author_username,omitempty"`
|
||||
PortalCustomizedWelcomeText string `json:"portal_customized_welcome_text,omitempty"`
|
||||
PortalCustomizedWelcomeTextEnabled bool `json:"portal_customized_welcome_text_enabled"`
|
||||
PortalCustomizedWelcomeTextPosition string `json:"portal_customized_welcome_text_position,omitempty"` // under_logo|above_boxes
|
||||
PortalEnabled bool `json:"portal_enabled"`
|
||||
PortalHostname string `json:"portal_hostname"` // ^[a-zA-Z0-9.-]+$|^$
|
||||
PortalUseHostname bool `json:"portal_use_hostname"`
|
||||
QuickpayTestmode bool `json:"quickpay_testmode"`
|
||||
RADIUSAuthType string `json:"radius_auth_type,omitempty"` // chap|mschapv2
|
||||
RADIUSDisconnectEnabled bool `json:"radius_disconnect_enabled"`
|
||||
RADIUSDisconnectPort int `json:"radius_disconnect_port,omitempty"` // [1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]
|
||||
RADIUSEnabled bool `json:"radius_enabled"`
|
||||
RADIUSprofileID string `json:"radiusprofile_id"`
|
||||
RedirectEnabled bool `json:"redirect_enabled"`
|
||||
RedirectHttps bool `json:"redirect_https"`
|
||||
RedirectToHttps bool `json:"redirect_to_https"`
|
||||
RedirectUrl string `json:"redirect_url,omitempty"`
|
||||
RestrictedDNSEnabled bool `json:"restricted_dns_enabled"`
|
||||
RestrictedDNSServers []string `json:"restricted_dns_servers,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
RestrictedSubnet string `json:"restricted_subnet_,omitempty"`
|
||||
TemplateEngine string `json:"template_engine,omitempty"` // jsp|angular
|
||||
VoucherCustomized bool `json:"voucher_customized"`
|
||||
VoucherEnabled bool `json:"voucher_enabled"`
|
||||
WechatAppID string `json:"wechat_app_id"`
|
||||
WechatEnabled bool `json:"wechat_enabled"`
|
||||
WechatShopID string `json:"wechat_shop_id"`
|
||||
XAuthorizeLoginid string `json:"x_authorize_loginid,omitempty"`
|
||||
XAuthorizeTransactionkey string `json:"x_authorize_transactionkey,omitempty"`
|
||||
XFacebookAppSecret string `json:"x_facebook_app_secret,omitempty"`
|
||||
XFacebookWifiGwSecret string `json:"x_facebook_wifi_gw_secret,omitempty"`
|
||||
XGoogleClientSecret string `json:"x_google_client_secret,omitempty"`
|
||||
XIPpayTerminalid string `json:"x_ippay_terminalid,omitempty"`
|
||||
XMerchantwarriorApikey string `json:"x_merchantwarrior_apikey,omitempty"`
|
||||
XMerchantwarriorApipassphrase string `json:"x_merchantwarrior_apipassphrase,omitempty"`
|
||||
XMerchantwarriorMerchantuuid string `json:"x_merchantwarrior_merchantuuid,omitempty"`
|
||||
XPassword string `json:"x_password,omitempty"`
|
||||
XPaypalPassword string `json:"x_paypal_password,omitempty"`
|
||||
XPaypalSignature string `json:"x_paypal_signature,omitempty"`
|
||||
XPaypalUsername string `json:"x_paypal_username,omitempty"`
|
||||
XQuickpayAgreementid string `json:"x_quickpay_agreementid,omitempty"`
|
||||
XQuickpayApikey string `json:"x_quickpay_apikey,omitempty"`
|
||||
XQuickpayMerchantid string `json:"x_quickpay_merchantid,omitempty"`
|
||||
XStripeApiKey string `json:"x_stripe_api_key,omitempty"`
|
||||
XWechatAppSecret string `json:"x_wechat_app_secret,omitempty"`
|
||||
XWechatSecretKey string `json:"x_wechat_secret_key,omitempty"`
|
||||
}
|
||||
27
unifi/setting_lcm.generated.go
Normal file
27
unifi/setting_lcm.generated.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingLcm struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Brightness int `json:"brightness,omitempty"` // [1-9]|[1-9][0-9]|100
|
||||
Enabled bool `json:"enabled"`
|
||||
IDleTimeout int `json:"idle_timeout,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600
|
||||
Sync bool `json:"sync"`
|
||||
TouchEvent bool `json:"touch_event"`
|
||||
}
|
||||
23
unifi/setting_locale.generated.go
Normal file
23
unifi/setting_locale.generated.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingLocale struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Timezone string `json:"timezone,omitempty"`
|
||||
}
|
||||
37
unifi/setting_mgmt.generated.go
Normal file
37
unifi/setting_mgmt.generated.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingMgmt struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
AdvancedFeatureEnabled bool `json:"advanced_feature_enabled"`
|
||||
AlertEnabled bool `json:"alert_enabled"`
|
||||
AutoUpgrade bool `json:"auto_upgrade"`
|
||||
LedEnabled bool `json:"led_enabled"`
|
||||
OutdoorModeEnabled bool `json:"outdoor_mode_enabled"`
|
||||
UnifiIDpEnabled bool `json:"unifi_idp_enabled"`
|
||||
XMgmtKey string `json:"x_mgmt_key,omitempty"` // [0-9a-f]{32}
|
||||
XSshAuthPasswordEnabled bool `json:"x_ssh_auth_password_enabled"`
|
||||
XSshBindWildcard bool `json:"x_ssh_bind_wildcard"`
|
||||
XSshEnabled bool `json:"x_ssh_enabled"`
|
||||
XSshKeys []string `json:"x_ssh_keys,omitempty"`
|
||||
XSshMd5Passwd string `json:"x_ssh_md5passwd,omitempty"`
|
||||
XSshPassword string `json:"x_ssh_password,omitempty"` // .{1,128}
|
||||
XSshSha512Passwd string `json:"x_ssh_sha512passwd,omitempty"`
|
||||
XSshUsername string `json:"x_ssh_username,omitempty"` // ^[_A-Za-z0-9][-_.A-Za-z0-9]{0,29}$
|
||||
}
|
||||
23
unifi/setting_network_optimization.generated.go
Normal file
23
unifi/setting_network_optimization.generated.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingNetworkOptimization struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
26
unifi/setting_ntp.generated.go
Normal file
26
unifi/setting_ntp.generated.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingNtp struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
NtpServer1 string `json:"ntp_server_1,omitempty"`
|
||||
NtpServer2 string `json:"ntp_server_2,omitempty"`
|
||||
NtpServer3 string `json:"ntp_server_3,omitempty"`
|
||||
NtpServer4 string `json:"ntp_server_4,omitempty"`
|
||||
}
|
||||
23
unifi/setting_porta.generated.go
Normal file
23
unifi/setting_porta.generated.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingPorta struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Ugw3WAN2Enabled bool `json:"ugw3_wan2_enabled"`
|
||||
}
|
||||
25
unifi/setting_provider_capabilities.generated.go
Normal file
25
unifi/setting_provider_capabilities.generated.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingProviderCapabilities struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Download int `json:"download,omitempty"` // ^[1-9][0-9]*$
|
||||
Enabled bool `json:"enabled"`
|
||||
Upload int `json:"upload,omitempty"` // ^[1-9][0-9]*$
|
||||
}
|
||||
33
unifi/setting_radio_ai.generated.go
Normal file
33
unifi/setting_radio_ai.generated.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingRadioAi struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
ChannelsNa []int `json:"channels_na,omitempty"` // 36|40|44|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165
|
||||
ChannelsNg []int `json:"channels_ng,omitempty"` // 1|2|3|4|5|6|7|8|9|10|11|12|13|14
|
||||
CronExpr string `json:"cron_expr,omitempty"`
|
||||
Default bool `json:"default"`
|
||||
Enabled bool `json:"enabled"`
|
||||
ExcludeDevices []string `json:"exclude_devices,omitempty"` // ([0-9a-z]{2}:){5}[0-9a-z]{2}
|
||||
HtModesNa []int `json:"ht_modes_na,omitempty"` // ^(20|40|80|160)$
|
||||
HtModesNg []int `json:"ht_modes_ng,omitempty"` // ^(20|40)$
|
||||
Optimize []string `json:"optimize,omitempty"` // channel|power
|
||||
Radios []string `json:"radios,omitempty"` // na|ng
|
||||
UseXY bool `json:"useXY"`
|
||||
}
|
||||
30
unifi/setting_radius.generated.go
Normal file
30
unifi/setting_radius.generated.go
Normal file
@@ -0,0 +1,30 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingRadius struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
AccountingEnabled bool `json:"accounting_enabled"`
|
||||
AcctPort int `json:"acct_port,omitempty"` // [1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]
|
||||
AuthPort int `json:"auth_port,omitempty"` // [1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]
|
||||
ConfigureWholeNetwork bool `json:"configure_whole_network"`
|
||||
Enabled bool `json:"enabled"`
|
||||
InterimUpdateInterval int `json:"interim_update_interval,omitempty"` // ^([6-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9][0-9]|86400)$
|
||||
TunneledReply bool `json:"tunneled_reply"`
|
||||
XSecret string `json:"x_secret,omitempty"` // [^\"\' ]{1,128}
|
||||
}
|
||||
31
unifi/setting_rsyslogd.generated.go
Normal file
31
unifi/setting_rsyslogd.generated.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingRsyslogd struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Debug bool `json:"debug"`
|
||||
Enabled bool `json:"enabled"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
NetconsoleEnabled bool `json:"netconsole_enabled"`
|
||||
NetconsoleHost string `json:"netconsole_host,omitempty"`
|
||||
NetconsolePort int `json:"netconsole_port,omitempty"` // [1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]
|
||||
Port int `json:"port,omitempty"` // [1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]
|
||||
ThisController bool `json:"this_controller"`
|
||||
ThisControllerEncryptedOnly bool `json:"this_controller_encrypted_only"`
|
||||
}
|
||||
27
unifi/setting_snmp.generated.go
Normal file
27
unifi/setting_snmp.generated.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingSnmp struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Community string `json:"community,omitempty"` // .{1,256}
|
||||
Enabled bool `json:"enabled"`
|
||||
EnabledV3 bool `json:"enabledV3"`
|
||||
Username string `json:"username,omitempty"` // [a-zA-Z0-9_-]{1,30}
|
||||
XPassword string `json:"x_password,omitempty"` // [^'"]{8,32}
|
||||
}
|
||||
29
unifi/setting_super_cloudaccess.generated.go
Normal file
29
unifi/setting_super_cloudaccess.generated.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingSuperCloudaccess struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
DeviceAuth string `json:"device_auth,omitempty"`
|
||||
DeviceID string `json:"device_id"`
|
||||
Enabled bool `json:"enabled"`
|
||||
UbicUuid string `json:"ubic_uuid,omitempty"`
|
||||
XCertificateArn string `json:"x_certificate_arn,omitempty"`
|
||||
XCertificatePem string `json:"x_certificate_pem,omitempty"`
|
||||
XPrivateKey string `json:"x_private_key,omitempty"`
|
||||
}
|
||||
23
unifi/setting_super_events.generated.go
Normal file
23
unifi/setting_super_events.generated.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingSuperEvents struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Ignored string `json:"_ignored,omitempty"`
|
||||
}
|
||||
25
unifi/setting_super_fwupdate.generated.go
Normal file
25
unifi/setting_super_fwupdate.generated.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingSuperFwupdate struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
ControllerChannel string `json:"controller_channel,omitempty"` // internal|alpha|beta|release-candidate|release
|
||||
FirmwareChannel string `json:"firmware_channel,omitempty"` // internal|alpha|beta|release-candidate|release
|
||||
SsoEnabled bool `json:"sso_enabled"`
|
||||
}
|
||||
24
unifi/setting_super_identity.generated.go
Normal file
24
unifi/setting_super_identity.generated.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingSuperIdentity struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
23
unifi/setting_super_mail.generated.go
Normal file
23
unifi/setting_super_mail.generated.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingSuperMail struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Provider string `json:"provider,omitempty"` // smtp|cloud|disabled
|
||||
}
|
||||
67
unifi/setting_super_mgmt.generated.go
Normal file
67
unifi/setting_super_mgmt.generated.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingSuperMgmt struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
AutoUpgrade bool `json:"auto_upgrade"`
|
||||
AutobackupCronExpr string `json:"autobackup_cron_expr,omitempty"`
|
||||
AutobackupDays int `json:"autobackup_days,omitempty"`
|
||||
AutobackupEnabled bool `json:"autobackup_enabled"`
|
||||
AutobackupGcsBucket string `json:"autobackup_gcs_bucket,omitempty"`
|
||||
AutobackupGcsCertificatePath string `json:"autobackup_gcs_certificate_path,omitempty"`
|
||||
AutobackupLocalPath string `json:"autobackup_local_path,omitempty"`
|
||||
AutobackupMaxFiles int `json:"autobackup_max_files,omitempty"`
|
||||
AutobackupPostActions []string `json:"autobackup_post_actions,omitempty"` // copy_local|copy_s3|copy_gcs|copy_cloud
|
||||
AutobackupS3AccessKey string `json:"autobackup_s3_access_key,omitempty"`
|
||||
AutobackupS3AccessSecret string `json:"autobackup_s3_access_secret,omitempty"`
|
||||
AutobackupS3Bucket string `json:"autobackup_s3_bucket,omitempty"`
|
||||
AutobackupTimezone string `json:"autobackup_timezone,omitempty"`
|
||||
BackupToCloudEnabled bool `json:"backup_to_cloud_enabled"`
|
||||
ContactInfoCity string `json:"contact_info_city,omitempty"`
|
||||
ContactInfoCompanyName string `json:"contact_info_company_name,omitempty"`
|
||||
ContactInfoCountry string `json:"contact_info_country,omitempty"`
|
||||
ContactInfoFullName string `json:"contact_info_full_name,omitempty"`
|
||||
ContactInfoPhoneNumber string `json:"contact_info_phone_number,omitempty"`
|
||||
ContactInfoShippingAddress1 string `json:"contact_info_shipping_address_1,omitempty"`
|
||||
ContactInfoShippingAddress2 string `json:"contact_info_shipping_address_2,omitempty"`
|
||||
ContactInfoState string `json:"contact_info_state,omitempty"`
|
||||
ContactInfoZip string `json:"contact_info_zip,omitempty"`
|
||||
DataRetentionTimeEnabled bool `json:"data_retention_time_enabled"`
|
||||
DataRetentionTimeInHoursFor5minutesScale int `json:"data_retention_time_in_hours_for_5minutes_scale,omitempty"`
|
||||
DataRetentionTimeInHoursForDailyScale int `json:"data_retention_time_in_hours_for_daily_scale,omitempty"`
|
||||
DataRetentionTimeInHoursForHourlyScale int `json:"data_retention_time_in_hours_for_hourly_scale,omitempty"`
|
||||
DataRetentionTimeInHoursForMonthlyScale int `json:"data_retention_time_in_hours_for_monthly_scale,omitempty"`
|
||||
DataRetentionTimeInHoursForOthers int `json:"data_retention_time_in_hours_for_others,omitempty"`
|
||||
DefaultSiteDeviceAuthPasswordAlert string `json:"default_site_device_auth_password_alert,omitempty"` // false
|
||||
Discoverable bool `json:"discoverable"`
|
||||
EnableAnalytics bool `json:"enable_analytics"`
|
||||
GoogleMapsApiKey string `json:"google_maps_api_key,omitempty"`
|
||||
ImageMapsUseGoogleEngine bool `json:"image_maps_use_google_engine"`
|
||||
LedEnabled bool `json:"led_enabled"`
|
||||
LiveChat string `json:"live_chat,omitempty"` // disabled|super-only|everyone
|
||||
LiveUpdates string `json:"live_updates,omitempty"` // disabled|live|auto
|
||||
MinimumUsableHdSpace int `json:"minimum_usable_hd_space,omitempty"`
|
||||
MinimumUsableSdSpace int `json:"minimum_usable_sd_space,omitempty"`
|
||||
OverrideInformHost bool `json:"override_inform_host"`
|
||||
StoreEnabled string `json:"store_enabled,omitempty"` // disabled|super-only|everyone
|
||||
TimeSeriesPerClientStatsEnabled bool `json:"time_series_per_client_stats_enabled"`
|
||||
UploadDebuggingInfoEnabled bool `json:"upload_debugging_info_enabled"`
|
||||
XSshPassword string `json:"x_ssh_password,omitempty"`
|
||||
XSshUsername string `json:"x_ssh_username,omitempty"`
|
||||
}
|
||||
32
unifi/setting_super_sdn.generated.go
Normal file
32
unifi/setting_super_sdn.generated.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingSuperSdn struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
AuthToken string `json:"auth_token,omitempty"`
|
||||
DeviceID string `json:"device_id"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Migrated bool `json:"migrated"`
|
||||
OauthAppID string `json:"oauth_app_id"`
|
||||
OauthEnabled bool `json:"oauth_enabled"`
|
||||
OauthRedirectUris []string `json:"oauth_redirect_uris,omitempty"`
|
||||
SsoLoginEnabled string `json:"sso_login_enabled,omitempty"`
|
||||
UbicUuid string `json:"ubic_uuid,omitempty"`
|
||||
XOauthAppSecret string `json:"x_oauth_app_secret,omitempty"`
|
||||
}
|
||||
31
unifi/setting_super_smtp.generated.go
Normal file
31
unifi/setting_super_smtp.generated.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingSuperSmtp struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Port int `json:"port,omitempty"` // [1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]|^$
|
||||
Sender string `json:"sender,omitempty"`
|
||||
UseAuth bool `json:"use_auth"`
|
||||
UseSender bool `json:"use_sender"`
|
||||
UseSsl bool `json:"use_ssl"`
|
||||
Username string `json:"username,omitempty"`
|
||||
XPassword string `json:"x_password,omitempty"`
|
||||
}
|
||||
77
unifi/setting_usg.generated.go
Normal file
77
unifi/setting_usg.generated.go
Normal file
@@ -0,0 +1,77 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingUsg struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
ArpCacheBaseReachable int `json:"arp_cache_base_reachable,omitempty"` // ^$|^[1-9]{1}[0-9]{0,4}$
|
||||
ArpCacheTimeout int `json:"arp_cache_timeout,omitempty"`
|
||||
BroadcastPing bool `json:"broadcast_ping"`
|
||||
DHCPRelayAgentsPackets string `json:"dhcp_relay_agents_packets"` // append|discard|forward|replace|^$
|
||||
DHCPRelayHopCount int `json:"dhcp_relay_hop_count,omitempty"` // ([1-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|^$
|
||||
DHCPRelayMaxSize int `json:"dhcp_relay_max_size,omitempty"` // (6[4-9]|[7-9][0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1[0-3][0-9]{2}|1400)|^$
|
||||
DHCPRelayPort int `json:"dhcp_relay_port,omitempty"` // [1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]|^$
|
||||
DHCPRelayServer1 string `json:"dhcp_relay_server_1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPRelayServer2 string `json:"dhcp_relay_server_2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPRelayServer3 string `json:"dhcp_relay_server_3"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPRelayServer4 string `json:"dhcp_relay_server_4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPRelayServer5 string `json:"dhcp_relay_server_5"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDHostfileUpdate bool `json:"dhcpd_hostfile_update"`
|
||||
DHCPDUseDNSmasq bool `json:"dhcpd_use_dnsmasq"`
|
||||
DNSmasqAllServers bool `json:"dnsmasq_all_servers"`
|
||||
EchoServer string `json:"echo_server,omitempty"` // [^\"\' ]{1,255}
|
||||
FirewallGuestDefaultLog bool `json:"firewall_guest_default_log"`
|
||||
FirewallLanDefaultLog bool `json:"firewall_lan_default_log"`
|
||||
FirewallWANDefaultLog bool `json:"firewall_wan_default_log"`
|
||||
FtpModule bool `json:"ftp_module"`
|
||||
GeoIPFilteringBlock string `json:"geo_ip_filtering_block,omitempty"` // block|allow
|
||||
GeoIPFilteringCountries string `json:"geo_ip_filtering_countries,omitempty"` // ^([A-Z]{2})?(,[A-Z]{2}){0,149}$
|
||||
GeoIPFilteringEnabled bool `json:"geo_ip_filtering_enabled"`
|
||||
GeoIPFilteringTrafficDirection string `json:"geo_ip_filtering_traffic_direction,omitempty"` // ^(both|ingress|egress)$
|
||||
GreModule bool `json:"gre_module"`
|
||||
H323Module bool `json:"h323_module"`
|
||||
IcmpTimeout int `json:"icmp_timeout,omitempty"`
|
||||
LldpEnableAll bool `json:"lldp_enable_all"`
|
||||
MdnsEnabled bool `json:"mdns_enabled"`
|
||||
MssClamp string `json:"mss_clamp,omitempty"` // auto|custom|disabled
|
||||
MssClampMss int `json:"mss_clamp_mss,omitempty"` // [1-9][0-9]{2,3}
|
||||
OffloadAccounting bool `json:"offload_accounting"`
|
||||
OffloadL2Blocking bool `json:"offload_l2_blocking"`
|
||||
OffloadSch bool `json:"offload_sch"`
|
||||
OtherTimeout int `json:"other_timeout,omitempty"`
|
||||
PptpModule bool `json:"pptp_module"`
|
||||
ReceiveRedirects bool `json:"receive_redirects"`
|
||||
SendRedirects bool `json:"send_redirects"`
|
||||
SipModule bool `json:"sip_module"`
|
||||
SynCookies bool `json:"syn_cookies"`
|
||||
TCPCloseTimeout int `json:"tcp_close_timeout,omitempty"`
|
||||
TCPCloseWaitTimeout int `json:"tcp_close_wait_timeout,omitempty"`
|
||||
TCPEstablishedTimeout int `json:"tcp_established_timeout,omitempty"`
|
||||
TCPFinWaitTimeout int `json:"tcp_fin_wait_timeout,omitempty"`
|
||||
TCPLastAckTimeout int `json:"tcp_last_ack_timeout,omitempty"`
|
||||
TCPSynRecvTimeout int `json:"tcp_syn_recv_timeout,omitempty"`
|
||||
TCPSynSentTimeout int `json:"tcp_syn_sent_timeout,omitempty"`
|
||||
TCPTimeWaitTimeout int `json:"tcp_time_wait_timeout,omitempty"`
|
||||
TFTPModule bool `json:"tftp_module"`
|
||||
UDPOtherTimeout int `json:"udp_other_timeout,omitempty"`
|
||||
UDPStreamTimeout int `json:"udp_stream_timeout,omitempty"`
|
||||
UpnpEnabled bool `json:"upnp_enabled"`
|
||||
UpnpNATPmpEnabled bool `json:"upnp_nat_pmp_enabled"`
|
||||
UpnpSecureMode bool `json:"upnp_secure_mode"`
|
||||
UpnpWANInterface string `json:"upnp_wan_interface,omitempty"` // WAN|WAN2
|
||||
}
|
||||
23
unifi/setting_usw.generated.go
Normal file
23
unifi/setting_usw.generated.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type SettingUsw struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
DHCPSnoop bool `json:"dhcp_snoop"`
|
||||
}
|
||||
29
unifi/sites.go
Normal file
29
unifi/sites.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package unifi
|
||||
|
||||
type Site struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
|
||||
// Hidden bool `json:"attr_hidden,omitempty"`
|
||||
// HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
// NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
// NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Name string `json:"name"`
|
||||
Description string `json:"desc"`
|
||||
|
||||
//Role string `json:"role"`
|
||||
}
|
||||
|
||||
func (c *Client) ListSites() ([]Site, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Site `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", "self/sites", nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
105
unifi/tag.generated.go
Normal file
105
unifi/tag.generated.go
Normal file
@@ -0,0 +1,105 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type Tag struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
MemberTable []string `json:"member_table,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listTag(site string) ([]Tag, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Tag `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/tag", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getTag(site, id string) (*Tag, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Tag `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/tag/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteTag(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/tag/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createTag(site string, d *Tag) (*Tag, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Tag `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/tag", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateTag(site string, d *Tag) (*Tag, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []Tag `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/tag/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
145
unifi/unifi.go
Normal file
145
unifi/unifi.go
Normal file
@@ -0,0 +1,145 @@
|
||||
package unifi //
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/cookiejar"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
type NotFoundError struct{}
|
||||
|
||||
func (err *NotFoundError) Error() string {
|
||||
return "not found"
|
||||
}
|
||||
|
||||
type APIError struct {
|
||||
RC string
|
||||
Message string
|
||||
}
|
||||
|
||||
func (err *APIError) Error() string {
|
||||
return err.Message
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
c *http.Client
|
||||
baseURL *url.URL
|
||||
}
|
||||
|
||||
func (c *Client) SetBaseURL(base string) error {
|
||||
var err error
|
||||
c.baseURL, err = url.Parse(base)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) SetHTTPClient(hc *http.Client) error {
|
||||
c.c = hc
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) Login(user, pass string) error {
|
||||
if c.c == nil {
|
||||
c.c = &http.Client{}
|
||||
|
||||
jar, _ := cookiejar.New(nil)
|
||||
c.c.Jar = jar
|
||||
}
|
||||
|
||||
err := c.do("POST", "login", &struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}{
|
||||
Username: user,
|
||||
Password: pass,
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) do(method, relativeURL string, reqBody interface{}, respBody interface{}) error {
|
||||
var (
|
||||
reqReader io.Reader
|
||||
err error
|
||||
reqBytes []byte
|
||||
)
|
||||
if reqBody != nil {
|
||||
|
||||
reqBytes, err = json.Marshal(reqBody)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reqReader = bytes.NewReader(reqBytes)
|
||||
}
|
||||
|
||||
reqURL, err := url.Parse(relativeURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
url := c.baseURL.ResolveReference(reqURL)
|
||||
|
||||
req, err := http.NewRequest(method, url.String(), reqReader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
req.Header.Set("User-Agent", "terraform-provider-unifi/0.1")
|
||||
|
||||
resp, err := c.c.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode == http.StatusNotFound {
|
||||
return &NotFoundError{}
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
fmt.Printf("Request Body:\n%s\n", string(reqBytes))
|
||||
errBody := struct {
|
||||
Meta meta `json:"meta"`
|
||||
}{}
|
||||
err = json.NewDecoder(resp.Body).Decode(&errBody)
|
||||
return fmt.Errorf("%s %s (%s) for %s %s", errBody.Meta.RC, errBody.Meta.Message, resp.Status, method, url.String())
|
||||
}
|
||||
|
||||
if respBody == nil || resp.ContentLength == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: check rc in addition to status code?
|
||||
|
||||
err = json.NewDecoder(resp.Body).Decode(respBody)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type meta struct {
|
||||
RC string `json:"rc"`
|
||||
Message string `json:"msg"`
|
||||
}
|
||||
|
||||
func (m *meta) error() error {
|
||||
if m.RC != "ok" {
|
||||
return &APIError{
|
||||
RC: m.RC,
|
||||
Message: m.Message,
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
113
unifi/user.generated.go
Normal file
113
unifi/user.generated.go
Normal file
@@ -0,0 +1,113 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type User struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Blocked bool `json:"blocked,omitempty"`
|
||||
FixedIP string `json:"fixed_ip,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
LastSeen int `json:"last_seen,omitempty"`
|
||||
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||
Name string `json:"name,omitempty"`
|
||||
NetworkID string `json:"network_id"`
|
||||
Note string `json:"note,omitempty"`
|
||||
UseFixedIP bool `json:"use_fixedip"`
|
||||
UserGroupID string `json:"usergroup_id"`
|
||||
}
|
||||
|
||||
func (c *Client) listUser(site string) ([]User, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []User `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/user", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getUser(site, id string) (*User, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []User `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/user/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteUser(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/user/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createUser(site string, d *User) (*User, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []User `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/user", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateUser(site string, d *User) (*User, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []User `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/user/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
138
unifi/user.go
Normal file
138
unifi/user.go
Normal file
@@ -0,0 +1,138 @@
|
||||
package unifi
|
||||
|
||||
import "fmt"
|
||||
|
||||
func (c *Client) GetUserByMAC(site, mac string) (*User, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []User `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/stat/user/%s", site, mac), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) CreateUser(site string, d *User) (*User, error) {
|
||||
reqBody := struct {
|
||||
Objects []struct {
|
||||
Data *User `json:"data"`
|
||||
} `json:"objects"`
|
||||
}{
|
||||
Objects: []struct {
|
||||
Data *User `json:"data"`
|
||||
}{
|
||||
{Data: d},
|
||||
},
|
||||
}
|
||||
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []User `json:"data"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/group/user", site), reqBody, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, fmt.Errorf("malformed group response")
|
||||
}
|
||||
|
||||
if err := respBody.Data[0].Meta.error(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data[0].Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0].Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) stamgr(site, cmd string, data map[string]interface{}) ([]User, error) {
|
||||
reqBody := map[string]interface{}{}
|
||||
|
||||
for k, v := range data {
|
||||
reqBody[k] = v
|
||||
}
|
||||
|
||||
reqBody["cmd"] = cmd
|
||||
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []User `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/cmd/stamgr", site), reqBody, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) BlockUserByMAC(site, mac string) error {
|
||||
users, err := c.stamgr(site, "block-sta", map[string]interface{}{
|
||||
"mac": mac,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(users) != 1 {
|
||||
return &NotFoundError{}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) UnblockUserByMAC(site, mac string) error {
|
||||
users, err := c.stamgr(site, "unblock-sta", map[string]interface{}{
|
||||
"mac": mac,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(users) != 1 {
|
||||
return &NotFoundError{}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) DeleteUserByMAC(site, mac string) error {
|
||||
users, err := c.stamgr(site, "forget-sta", map[string]interface{}{
|
||||
"macs": []string{mac},
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(users) != 1 {
|
||||
return &NotFoundError{}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) ListUser(site string) ([]User, error) {
|
||||
return c.listUser(site)
|
||||
}
|
||||
|
||||
func (c *Client) GetUser(site, id string) (*User, error) {
|
||||
return c.getUser(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) UpdateUser(site string, d *User) (*User, error) {
|
||||
return c.updateUser(site, d)
|
||||
}
|
||||
106
unifi/user_group.generated.go
Normal file
106
unifi/user_group.generated.go
Normal file
@@ -0,0 +1,106 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type UserGroup struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
QOSRateMaxDown int `json:"qos_rate_max_down,omitempty"` // -1|[2-9]|[1-9][0-9]{1,4}|100000
|
||||
QOSRateMaxUp int `json:"qos_rate_max_up,omitempty"` // -1|[2-9]|[1-9][0-9]{1,4}|100000
|
||||
}
|
||||
|
||||
func (c *Client) listUserGroup(site string) ([]UserGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []UserGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/usergroup", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getUserGroup(site, id string) (*UserGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []UserGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/usergroup/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteUserGroup(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/usergroup/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createUserGroup(site string, d *UserGroup) (*UserGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []UserGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/usergroup", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateUserGroup(site string, d *UserGroup) (*UserGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []UserGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/usergroup/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
21
unifi/user_group.go
Normal file
21
unifi/user_group.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package unifi
|
||||
|
||||
func (c *Client) ListUserGroup(site string) ([]UserGroup, error) {
|
||||
return c.listUserGroup(site)
|
||||
}
|
||||
|
||||
func (c *Client) GetUserGroup(site, id string) (*UserGroup, error) {
|
||||
return c.getUserGroup(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) DeleteUserGroup(site, id string) error {
|
||||
return c.deleteUserGroup(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) CreateUserGroup(site string, d *UserGroup) (*UserGroup, error) {
|
||||
return c.createUserGroup(site, d)
|
||||
}
|
||||
|
||||
func (c *Client) UpdateUserGroup(site string, d *UserGroup) (*UserGroup, error) {
|
||||
return c.updateUserGroup(site, d)
|
||||
}
|
||||
109
unifi/virtual_device.generated.go
Normal file
109
unifi/virtual_device.generated.go
Normal file
@@ -0,0 +1,109 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type VirtualDevice struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
HeightInMeters float64 `json:"heightInMeters,omitempty"`
|
||||
Locked bool `json:"locked"`
|
||||
MapID string `json:"map_id"`
|
||||
Type string `json:"type,omitempty"` // uap|usg|usw
|
||||
X string `json:"x,omitempty"`
|
||||
Y string `json:"y,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listVirtualDevice(site string) ([]VirtualDevice, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []VirtualDevice `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/virtualdevice", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getVirtualDevice(site, id string) (*VirtualDevice, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []VirtualDevice `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/virtualdevice/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteVirtualDevice(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/virtualdevice/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createVirtualDevice(site string, d *VirtualDevice) (*VirtualDevice, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []VirtualDevice `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/virtualdevice", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateVirtualDevice(site string, d *VirtualDevice) (*VirtualDevice, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []VirtualDevice `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/virtualdevice/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
162
unifi/wlan.generated.go
Normal file
162
unifi/wlan.generated.go
Normal file
@@ -0,0 +1,162 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type WLAN struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
BroadcastFilterEnabled bool `json:"bc_filter_enabled"`
|
||||
BroadcastFilterList []string `json:"bc_filter_list,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||
CountryBeacon bool `json:"country_beacon"`
|
||||
DPIEnabled bool `json:"dpi_enabled"`
|
||||
DPIgroupID string `json:"dpigroup_id"` // [\d\w]+|^$
|
||||
DTIMMode string `json:"dtim_mode,omitempty"` // default|custom
|
||||
DTIMNa int `json:"dtim_na,omitempty"` // ^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DTIMNg int `json:"dtim_ng,omitempty"` // ^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
ElementAdopt bool `json:"element_adopt"`
|
||||
Enabled bool `json:"enabled"`
|
||||
FastRoamingEnabled bool `json:"fast_roaming_enabled"`
|
||||
GroupRekey int `json:"group_rekey,omitempty"` // ^(0|[6-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9][0-9]|86400)$
|
||||
HideSSID bool `json:"hide_ssid"`
|
||||
Hotspot2ConfEnabled bool `json:"hotspot2conf_enabled"`
|
||||
Hotspot2ConfID string `json:"hotspot2conf_id"`
|
||||
IappEnabled bool `json:"iapp_enabled"`
|
||||
IsGuest bool `json:"is_guest"`
|
||||
MACFilterEnabled bool `json:"mac_filter_enabled"`
|
||||
MACFilterList []string `json:"mac_filter_list,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||
MACFilterPolicy string `json:"mac_filter_policy,omitempty"` // allow|deny
|
||||
MulticastEnhanceEnabled bool `json:"mcastenhance_enabled"`
|
||||
MinrateNaAdvertisingRates bool `json:"minrate_na_advertising_rates"`
|
||||
MinrateNaBeaconRateKbps int `json:"minrate_na_beacon_rate_kbps,omitempty"`
|
||||
MinrateNaDataRateKbps int `json:"minrate_na_data_rate_kbps,omitempty"`
|
||||
MinrateNaEnabled bool `json:"minrate_na_enabled"`
|
||||
MinrateNaMgmtRateKbps int `json:"minrate_na_mgmt_rate_kbps,omitempty"`
|
||||
MinrateNgAdvertisingRates bool `json:"minrate_ng_advertising_rates"`
|
||||
MinrateNgBeaconRateKbps int `json:"minrate_ng_beacon_rate_kbps,omitempty"`
|
||||
MinrateNgCckRatesEnabled bool `json:"minrate_ng_cck_rates_enabled"`
|
||||
MinrateNgDataRateKbps int `json:"minrate_ng_data_rate_kbps,omitempty"`
|
||||
MinrateNgEnabled bool `json:"minrate_ng_enabled"`
|
||||
MinrateNgMgmtRateKbps int `json:"minrate_ng_mgmt_rate_kbps,omitempty"`
|
||||
Name string `json:"name,omitempty"` // .{1,32}
|
||||
NameCombineEnabled bool `json:"name_combine_enabled"`
|
||||
NameCombineSuffix string `json:"name_combine_suffix,omitempty"` // .{0,8}
|
||||
No2GhzOui bool `json:"no2ghz_oui"`
|
||||
Priority string `json:"priority,omitempty"` // medium|high|low
|
||||
RADIUSDasEnabled bool `json:"radius_das_enabled"`
|
||||
RADIUSMACAuthEnabled bool `json:"radius_mac_auth_enabled"`
|
||||
RADIUSMACaclEmptyPassword bool `json:"radius_macacl_empty_password"`
|
||||
RADIUSMACaclFormat string `json:"radius_macacl_format,omitempty"` // none_lower|hyphen_lower|colon_lower|none_upper|hyphen_upper|colon_upper
|
||||
RADIUSprofileID string `json:"radiusprofile_id"`
|
||||
RoamClusterID int `json:"roam_cluster_id,omitempty"` // [0-9]|[1-2][0-9]|[3][0-1]|^$
|
||||
RrmEnabled bool `json:"rrm_enabled"`
|
||||
Schedule []string `json:"schedule,omitempty"` // (sun|mon|tue|wed|thu|fri|sat)(\-(sun|mon|tue|wed|thu|fri|sat))?\|([0-2][0-9][0-5][0-9])\-([0-2][0-9][0-5][0-9])
|
||||
ScheduleEnabled bool `json:"schedule_enabled"`
|
||||
ScheduleReversed bool `json:"schedule_reversed"`
|
||||
Security string `json:"security,omitempty"` // open|wpapsk|wep|wpaeap
|
||||
UapsdEnabled bool `json:"uapsd_enabled"`
|
||||
UserGroupID string `json:"usergroup_id"`
|
||||
VLAN int `json:"vlan,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-5]|^$
|
||||
VLANEnabled bool `json:"vlan_enabled"`
|
||||
WEPIDX int `json:"wep_idx,omitempty"` // [1-4]
|
||||
WLANGroupID string `json:"wlangroup_id"`
|
||||
WPAEnc string `json:"wpa_enc,omitempty"` // auto|ccmp
|
||||
WPAMode string `json:"wpa_mode,omitempty"` // auto|wpa1|wpa2
|
||||
XIappKey string `json:"x_iapp_key,omitempty"` // [0-9A-Fa-f]{32}
|
||||
XPassphrase string `json:"x_passphrase,omitempty"` // [\x20-\x7E]{8,63}|[0-9a-fA-F]{64}
|
||||
XWEP string `json:"x_wep,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listWLAN(site string) ([]WLAN, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []WLAN `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/wlanconf", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getWLAN(site, id string) (*WLAN, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []WLAN `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/wlanconf/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteWLAN(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/wlanconf/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createWLAN(site string, d *WLAN) (*WLAN, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []WLAN `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/wlanconf", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateWLAN(site string, d *WLAN) (*WLAN, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []WLAN `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/wlanconf/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
52
unifi/wlan.go
Normal file
52
unifi/wlan.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func (n *WLAN) UnmarshalJSON(b []byte) error {
|
||||
type Alias WLAN
|
||||
aux := &struct {
|
||||
VLAN json.Number `json:"vlan"`
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(n),
|
||||
}
|
||||
err := json.Unmarshal(b, &aux)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
n.VLAN = 0
|
||||
if aux.VLAN.String() != "" {
|
||||
vlan, err := aux.VLAN.Int64()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
n.VLAN = int(vlan)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) CreateWLAN(site string, d *WLAN) (*WLAN, error) {
|
||||
if d.Schedule == nil {
|
||||
d.Schedule = []string{}
|
||||
}
|
||||
|
||||
return c.createWLAN(site, d)
|
||||
}
|
||||
|
||||
func (c *Client) ListWLAN(site string) ([]WLAN, error) {
|
||||
return c.listWLAN(site)
|
||||
}
|
||||
|
||||
func (c *Client) GetWLAN(site, id string) (*WLAN, error) {
|
||||
return c.getWLAN(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) DeleteWLAN(site, id string) error {
|
||||
return c.deleteWLAN(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) UpdateWLAN(site string, d *WLAN) (*WLAN, error) {
|
||||
return c.updateWLAN(site, d)
|
||||
}
|
||||
110
unifi/wlan_group.generated.go
Normal file
110
unifi/wlan_group.generated.go
Normal file
@@ -0,0 +1,110 @@
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// just to fix compile issues with the import
|
||||
var _ fmt.Formatter
|
||||
|
||||
type WLANGroup struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
|
||||
Hidden bool `json:"attr_hidden,omitempty"`
|
||||
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
BSupported bool `json:"b_supported"`
|
||||
LoadbalanceEnabled bool `json:"loadbalance_enabled"`
|
||||
Maxsta int `json:"maxsta,omitempty"` // [1-9]|[1-9][0-9]|1[0-9]{2}|200|^$
|
||||
MinRSSI string `json:"minrssi,omitempty"`
|
||||
MinRSSIEnabled bool `json:"minrssi_enabled"`
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
PMFMode string `json:"pmf_mode,omitempty"` // disabled|optional|required
|
||||
}
|
||||
|
||||
func (c *Client) listWLANGroup(site string) ([]WLANGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []WLANGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/wlangroup", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody.Data, nil
|
||||
}
|
||||
|
||||
func (c *Client) getWLANGroup(site, id string) (*WLANGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []WLANGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("GET", fmt.Sprintf("s/%s/rest/wlangroup/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) deleteWLANGroup(site, id string) error {
|
||||
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/wlangroup/%s", site, id), struct{}{}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) createWLANGroup(site string, d *WLANGroup) (*WLANGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []WLANGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("POST", fmt.Sprintf("s/%s/rest/wlangroup", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateWLANGroup(site string, d *WLANGroup) (*WLANGroup, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []WLANGroup `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do("PUT", fmt.Sprintf("s/%s/rest/wlangroup/%s", site, d.ID), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
21
unifi/wlan_group.go
Normal file
21
unifi/wlan_group.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package unifi
|
||||
|
||||
func (c *Client) ListWLANGroup(site string) ([]WLANGroup, error) {
|
||||
return c.listWLANGroup(site)
|
||||
}
|
||||
|
||||
func (c *Client) GetWLANGroup(site, id string) (*WLANGroup, error) {
|
||||
return c.getWLANGroup(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) DeleteWLANGroup(site, id string) error {
|
||||
return c.deleteWLANGroup(site, id)
|
||||
}
|
||||
|
||||
func (c *Client) CreateWLANGroup(site string, d *WLANGroup) (*WLANGroup, error) {
|
||||
return c.createWLANGroup(site, d)
|
||||
}
|
||||
|
||||
func (c *Client) UpdateWLANGroup(site string, d *WLANGroup) (*WLANGroup, error) {
|
||||
return c.updateWLANGroup(site, d)
|
||||
}
|
||||
Reference in New Issue
Block a user