Added static DNS record

This commit is contained in:
appkins
2024-07-13 04:52:27 -05:00
parent 85af09f5e0
commit e99c608dec
62 changed files with 1406 additions and 11 deletions

View File

@@ -64,6 +64,8 @@ func (dst *{{ $k }}) UnmarshalJSON(b []byte) error {
}
{{ end }}
{{- $apiVersion2 := or (eq .StructName "APGroup") (eq .StructName "DNSRecord") }}
{{ if not .IsSetting }}
func (c *Client) list{{ .StructName }}(ctx context.Context, site string) ([]{{ .StructName }}, error) {
var respBody struct {
@@ -71,7 +73,7 @@ func (c *Client) list{{ .StructName }}(ctx context.Context, site string) ([]{{ .
Data []{{ .StructName }} `json:"data"`
}
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/{{ if eq .StructName "Device" }}stat/{{else if eq .StructName "APGroup" }}{{ else }}rest/{{ end }}{{ .ResourcePath }}", site), nil, &respBody)
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/{{ if eq .StructName "Device" }}stat/{{ else if $apiVersion2 }}{{ else }}rest/{{ end }}{{ .ResourcePath }}", site), nil, &respBody)
if err != nil {
return nil, err
}
@@ -88,7 +90,7 @@ func (c *Client) get{{ .StructName }}(ctx context.Context, site{{ if not .IsSett
{{ if .IsSetting }}
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/{{ .ResourcePath }}", site), nil, &respBody)
{{- else }}
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/{{ if eq .StructName "Device" }}stat{{ else }}rest{{ end }}/{{ .ResourcePath }}/%s", site, id), nil, &respBody)
err := c.do(ctx, "GET", fmt.Sprintf("{{ if eq .StructName "DNSRecord" }}%s/site/%s/{{ .ResourcePath }}/%s", c.apiV2Path{{ else }}s/%s/{{ if eq .StructName "Device" }}stat/{{ else }}rest/{{ end }}{{ .ResourcePath }}/%s"{{ end }}, site, id), nil, &respBody)
{{- end }}
if err != nil {
return nil, err
@@ -104,7 +106,7 @@ func (c *Client) get{{ .StructName }}(ctx context.Context, site{{ if not .IsSett
{{ if not .IsSetting }}
func (c *Client) delete{{ .StructName }}(ctx context.Context, site, id string) error {
err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/{{ .ResourcePath }}/%s", site, id), struct{}{}, nil)
err := c.do(ctx, "DELETE", fmt.Sprintf("{{ if eq .StructName "DNSRecord" }}%s/site/%s/{{ .ResourcePath }}/%s", c.apiV2Path{{ else }}s/%s/rest/{{ .ResourcePath }}/%s"{{ end }}, site, id), struct{}{}, nil)
if err != nil {
return err
}
@@ -117,7 +119,7 @@ func (c *Client) create{{ .StructName }}(ctx context.Context, site string, d *{{
Data []{{ .StructName }} `json:"data"`
}
err := c.do(ctx, "POST", fmt.Sprintf("s/%s/rest/{{ .ResourcePath }}", site), d, &respBody)
err := c.do(ctx, "POST", fmt.Sprintf("{{ if eq .StructName "DNSRecord" }}%s/site/%s/{{ .ResourcePath }}", c.apiV2Path{{ else }}s/%s/rest/{{ .ResourcePath }}"{{ end }}, site), d, &respBody)
if err != nil {
return nil, err
}
@@ -141,7 +143,7 @@ func (c *Client) update{{ .StructName }}(ctx context.Context, site string, d *{{
d.Key = "{{ .ResourcePath }}"
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/{{ .ResourcePath }}", site), d, &respBody)
{{- else }}
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/{{ .ResourcePath }}/%s", site, d.ID), d, &respBody)
err := c.do(ctx, "PUT", fmt.Sprintf("{{ if eq .StructName "DNSRecord" }}%s/site/%s/{{ .ResourcePath }}/%s", c.apiV2Path{{ else }}s/%s/rest/{{ .ResourcePath }}/%s"{{ end }}, site, d.ID), d, &respBody)
{{- end }}
if err != nil {
return nil, err

51
fields/client.go.tmpl Normal file
View File

@@ -0,0 +1,51 @@
{{- $structName := .StructName }}
{{ define "field" }}
{{ .FieldName }} {{ if .IsArray }}[]{{end}}{{ .FieldType }} `json:"{{ .JSONName }}{{ if .OmitEmpty }},omitempty{{ end }}"` {{ if .FieldValidation }}// {{ .FieldValidation }}{{ end }} {{- end }}
{{ define "field-customUnmarshalType" }}
{{- if eq .CustomUnmarshalType "" }}{{else}}
{{ .FieldName }} {{ if .IsArray }}[]{{end}}{{ .CustomUnmarshalType }} `json:"{{ .JSONName }}"`{{ end }} {{- end }}
{{ define "typecast" }}
{{- if ne .CustomUnmarshalFunc "" }}
dst.{{ .FieldName }}= {{ .CustomUnmarshalFunc }}(aux.{{ .FieldName }})
{{- else if eq .CustomUnmarshalType "" }}{{else}}
{{- if .IsArray }}
dst.{{ .FieldName }}= make([]{{ .FieldType }}, len(aux.{{ .FieldName }}))
for i, v := range aux.{{ .FieldName }} {
dst.{{ .FieldName }}[i] = {{ .FieldType }}(v)
}
{{- else }}
dst.{{ .FieldName }} = {{ .FieldType }}(aux.{{ .FieldName }})
{{- end }}{{- end }}{{- end }}
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
{{ if not .IsSetting }}
func (c *Client) List{{ .StructName }}(ctx context.Context, site string) ([]{{ .StructName }}, error) {
return c.list{{ .StructName }}(ctx, site)
}
{{- end }}
func (c *Client) Get{{ .StructName }}(ctx context.Context, site{{ if not .IsSetting }}, id{{ end }} string) (*{{ .StructName }}, error) {
return c.get{{ .StructName }}(ctx, site{{ if not .IsSetting }}, id{{ end }})
}
{{ if not .IsSetting }}
func (c *Client) Delete{{ .StructName }}(ctx context.Context, site, id string) error {
return c.delete{{ .StructName }}(ctx, site, id)
}
func (c *Client) Create{{ .StructName }}(ctx context.Context, site string, d *{{ .StructName }}) (*{{ .StructName }}, error) {
return c.create{{ .StructName }}(ctx, site, d)
}
{{- end }}
func (c *Client) Update{{ .StructName }}(ctx context.Context, site string, d *{{ .StructName }}) (*{{ .StructName }}, error) {
return c.update{{ .StructName }}(ctx, site, d)
}

View File

@@ -0,0 +1,10 @@
{
"enabled": "false|true",
"key": ".{1,128}",
"port": "[0-9]{1,8}",
"priority": ".{1,128}",
"record_type": "A|AAAA|CNAME|MX|NS|PTR|SOA|SRV|TXT",
"ttl": "[0-9]{1,10}",
"value": ".{1,256}",
"weight": "[0-9]{1,10}"
}

View File

@@ -159,6 +159,63 @@ func extractJSON(jarFile, fieldsDir string) error {
}
}
wd, err := os.Getwd()
if err != nil {
panic(err)
}
rootDir := findModuleRoot(wd)
srcDir := path.Join(rootDir, "fields")
files, err := os.ReadDir(path.Join(srcDir, "custom"))
if err != nil {
return fmt.Errorf("unable to read custom directory: %w", err)
}
for _, file := range files {
if !file.IsDir() {
fs, err := os.Open(path.Join(srcDir, "custom", file.Name()))
if err != nil {
return fmt.Errorf("unable to open file: %w", err)
}
defer fs.Close()
rf, err := os.Create(filepath.Join(fieldsDir, file.Name()))
if err != nil {
return fmt.Errorf("unable to create file: %w", err)
}
defer rf.Close()
_, err = io.Copy(rf, fs)
if err != nil {
return fmt.Errorf("unable to copy file: %w", err)
}
_, err = io.ReadAll(fs)
if err != nil {
return fmt.Errorf("unable to read file: %w", err)
}
}
fmt.Println(file.Name(), file.IsDir())
}
// TODO: cleanup JSON
return nil
}
func findModuleRoot(dir string) (roots string) {
if dir == "" {
panic("dir not set")
}
dir = filepath.Clean(dir)
// Look for enclosing go.mod.
for {
if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() {
return dir
}
d := filepath.Dir(dir)
if d == dir {
break
}
dir = d
}
return ""
}

View File

@@ -148,6 +148,8 @@ func NewResource(structName string, resourcePath string) *Resource {
// Removed in v7, retaining for backwards compatibility
baseType.Fields["MdnsEnabled"] = NewFieldInfo("MdnsEnabled", "mdns_enabled", "bool", "", false, false, "")
}
case resource.StructName == "DNSRecord":
resource.ResourcePath = "static-dns"
case resource.StructName == "Device":
baseType.Fields[" MAC"] = NewFieldInfo("MAC", "mac", "string", "", true, false, "")
baseType.Fields["Adopted"] = NewFieldInfo("Adopted", "adopted", "bool", "", false, false, "")
@@ -429,7 +431,7 @@ func main() {
}
var code string
if code, err = resource.generateCode(); err != nil {
if code, err = resource.generateCode(false); err != nil {
panic(err)
}
@@ -437,6 +439,22 @@ func main() {
if err := os.WriteFile(filepath.Join(outDir, goFile), ([]byte)(code), 0o644); err != nil {
panic(err)
}
implFile := strcase.ToSnake(structName) + ".go"
implFilePath := filepath.Join(outDir, implFile)
if _, err := os.Stat(implFilePath); err != nil {
if errors.Is(err, os.ErrNotExist) {
var implCode string
if implCode, err = resource.generateCode(true); err != nil {
panic(err)
}
if err := os.WriteFile(filepath.Join(implFilePath), ([]byte)(implCode), 0o644); err != nil {
panic(err)
}
}
}
}
// Write version file.
@@ -583,12 +601,20 @@ func (r *Resource) processJSON(b []byte) error {
//go:embed api.go.tmpl
var apiGoTemplate string
func (r *Resource) generateCode() (string, error) {
//go:embed client.go.tmpl
var clientGoTemplate string
func (r *Resource) generateCode(isImpl bool) (string, error) {
var err error
var buf bytes.Buffer
writer := io.Writer(&buf)
tpl := template.Must(template.New("api.go.tmpl").Parse(apiGoTemplate))
var tpl *template.Template
if isImpl {
tpl = template.Must(template.New("client.go.tmpl").Parse(clientGoTemplate))
} else {
tpl = template.Must(template.New("api.go.tmpl").Parse(apiGoTemplate))
}
err = tpl.Execute(writer, r)
if err != nil {

28
unifi/broadcast_group.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListBroadcastGroup(ctx context.Context, site string) ([]BroadcastGroup, error) {
return c.listBroadcastGroup(ctx, site)
}
func (c *Client) GetBroadcastGroup(ctx context.Context, site, id string) (*BroadcastGroup, error) {
return c.getBroadcastGroup(ctx, site, id)
}
func (c *Client) DeleteBroadcastGroup(ctx context.Context, site, id string) error {
return c.deleteBroadcastGroup(ctx, site, id)
}
func (c *Client) CreateBroadcastGroup(ctx context.Context, site string, d *BroadcastGroup) (*BroadcastGroup, error) {
return c.createBroadcastGroup(ctx, site, d)
}
func (c *Client) UpdateBroadcastGroup(ctx context.Context, site string, d *BroadcastGroup) (*BroadcastGroup, error) {
return c.updateBroadcastGroup(ctx, site, d)
}

28
unifi/channel_plan.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListChannelPlan(ctx context.Context, site string) ([]ChannelPlan, error) {
return c.listChannelPlan(ctx, site)
}
func (c *Client) GetChannelPlan(ctx context.Context, site, id string) (*ChannelPlan, error) {
return c.getChannelPlan(ctx, site, id)
}
func (c *Client) DeleteChannelPlan(ctx context.Context, site, id string) error {
return c.deleteChannelPlan(ctx, site, id)
}
func (c *Client) CreateChannelPlan(ctx context.Context, site string, d *ChannelPlan) (*ChannelPlan, error) {
return c.createChannelPlan(ctx, site, d)
}
func (c *Client) UpdateChannelPlan(ctx context.Context, site string, d *ChannelPlan) (*ChannelPlan, error) {
return c.updateChannelPlan(ctx, site, d)
}

28
unifi/dashboard.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListDashboard(ctx context.Context, site string) ([]Dashboard, error) {
return c.listDashboard(ctx, site)
}
func (c *Client) GetDashboard(ctx context.Context, site, id string) (*Dashboard, error) {
return c.getDashboard(ctx, site, id)
}
func (c *Client) DeleteDashboard(ctx context.Context, site, id string) error {
return c.deleteDashboard(ctx, site, id)
}
func (c *Client) CreateDashboard(ctx context.Context, site string, d *Dashboard) (*Dashboard, error) {
return c.createDashboard(ctx, site, d)
}
func (c *Client) UpdateDashboard(ctx context.Context, site string, d *Dashboard) (*Dashboard, error) {
return c.updateDashboard(ctx, site, d)
}

28
unifi/dhcp_option.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListDHCPOption(ctx context.Context, site string) ([]DHCPOption, error) {
return c.listDHCPOption(ctx, site)
}
func (c *Client) GetDHCPOption(ctx context.Context, site, id string) (*DHCPOption, error) {
return c.getDHCPOption(ctx, site, id)
}
func (c *Client) DeleteDHCPOption(ctx context.Context, site, id string) error {
return c.deleteDHCPOption(ctx, site, id)
}
func (c *Client) CreateDHCPOption(ctx context.Context, site string, d *DHCPOption) (*DHCPOption, error) {
return c.createDHCPOption(ctx, site, d)
}
func (c *Client) UpdateDHCPOption(ctx context.Context, site string, d *DHCPOption) (*DHCPOption, error) {
return c.updateDHCPOption(ctx, site, d)
}

140
unifi/dns_record.generated.go generated Normal file
View File

@@ -0,0 +1,140 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
"encoding/json"
"fmt"
)
// just to fix compile issues with the import
var (
_ context.Context
_ fmt.Formatter
_ json.Marshaler
)
type DNSRecord 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"`
Key string `json:"key,omitempty"` // .{1,128}
Port int `json:"port,omitempty"`
Priority string `json:"priority,omitempty"` // .{1,128}
RecordType string `json:"record_type,omitempty"` // A|AAAA|CNAME|MX|NS|PTR|SOA|SRV|TXT
Ttl int `json:"ttl,omitempty"`
Value string `json:"value,omitempty"` // .{1,256}
Weight int `json:"weight,omitempty"`
}
func (dst *DNSRecord) UnmarshalJSON(b []byte) error {
type Alias DNSRecord
aux := &struct {
Port emptyStringInt `json:"port"`
Ttl emptyStringInt `json:"ttl"`
Weight emptyStringInt `json:"weight"`
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
dst.Port = int(aux.Port)
dst.Ttl = int(aux.Ttl)
dst.Weight = int(aux.Weight)
return nil
}
func (c *Client) listDNSRecord(ctx context.Context, site string) ([]DNSRecord, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DNSRecord `json:"data"`
}
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/static-dns", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getDNSRecord(ctx context.Context, site, id string) (*DNSRecord, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DNSRecord `json:"data"`
}
err := c.do(ctx, "GET", fmt.Sprintf("%s/site/%s/static-dns/%s", c.apiV2Path, 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) deleteDNSRecord(ctx context.Context, site, id string) error {
err := c.do(ctx, "DELETE", fmt.Sprintf("%s/site/%s/static-dns/%s", c.apiV2Path, site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createDNSRecord(ctx context.Context, site string, d *DNSRecord) (*DNSRecord, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DNSRecord `json:"data"`
}
err := c.do(ctx, "POST", fmt.Sprintf("%s/site/%s/static-dns", c.apiV2Path, 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) updateDNSRecord(ctx context.Context, site string, d *DNSRecord) (*DNSRecord, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DNSRecord `json:"data"`
}
err := c.do(ctx, "PUT", fmt.Sprintf("%s/site/%s/static-dns/%s", c.apiV2Path, 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
}

28
unifi/dns_record.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListDNSRecord(ctx context.Context, site string) ([]DNSRecord, error) {
return c.listDNSRecord(ctx, site)
}
func (c *Client) GetDNSRecord(ctx context.Context, site, id string) (*DNSRecord, error) {
return c.getDNSRecord(ctx, site, id)
}
func (c *Client) DeleteDNSRecord(ctx context.Context, site, id string) error {
return c.deleteDNSRecord(ctx, site, id)
}
func (c *Client) CreateDNSRecord(ctx context.Context, site string, d *DNSRecord) (*DNSRecord, error) {
return c.createDNSRecord(ctx, site, d)
}
func (c *Client) UpdateDNSRecord(ctx context.Context, site string, d *DNSRecord) (*DNSRecord, error) {
return c.updateDNSRecord(ctx, site, d)
}

28
unifi/dpi_app.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListDpiApp(ctx context.Context, site string) ([]DpiApp, error) {
return c.listDpiApp(ctx, site)
}
func (c *Client) GetDpiApp(ctx context.Context, site, id string) (*DpiApp, error) {
return c.getDpiApp(ctx, site, id)
}
func (c *Client) DeleteDpiApp(ctx context.Context, site, id string) error {
return c.deleteDpiApp(ctx, site, id)
}
func (c *Client) CreateDpiApp(ctx context.Context, site string, d *DpiApp) (*DpiApp, error) {
return c.createDpiApp(ctx, site, d)
}
func (c *Client) UpdateDpiApp(ctx context.Context, site string, d *DpiApp) (*DpiApp, error) {
return c.updateDpiApp(ctx, site, d)
}

28
unifi/dpi_group.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListDpiGroup(ctx context.Context, site string) ([]DpiGroup, error) {
return c.listDpiGroup(ctx, site)
}
func (c *Client) GetDpiGroup(ctx context.Context, site, id string) (*DpiGroup, error) {
return c.getDpiGroup(ctx, site, id)
}
func (c *Client) DeleteDpiGroup(ctx context.Context, site, id string) error {
return c.deleteDpiGroup(ctx, site, id)
}
func (c *Client) CreateDpiGroup(ctx context.Context, site string, d *DpiGroup) (*DpiGroup, error) {
return c.createDpiGroup(ctx, site, d)
}
func (c *Client) UpdateDpiGroup(ctx context.Context, site string, d *DpiGroup) (*DpiGroup, error) {
return c.updateDpiGroup(ctx, site, d)
}

28
unifi/heat_map.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListHeatMap(ctx context.Context, site string) ([]HeatMap, error) {
return c.listHeatMap(ctx, site)
}
func (c *Client) GetHeatMap(ctx context.Context, site, id string) (*HeatMap, error) {
return c.getHeatMap(ctx, site, id)
}
func (c *Client) DeleteHeatMap(ctx context.Context, site, id string) error {
return c.deleteHeatMap(ctx, site, id)
}
func (c *Client) CreateHeatMap(ctx context.Context, site string, d *HeatMap) (*HeatMap, error) {
return c.createHeatMap(ctx, site, d)
}
func (c *Client) UpdateHeatMap(ctx context.Context, site string, d *HeatMap) (*HeatMap, error) {
return c.updateHeatMap(ctx, site, d)
}

28
unifi/heat_map_point.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListHeatMapPoint(ctx context.Context, site string) ([]HeatMapPoint, error) {
return c.listHeatMapPoint(ctx, site)
}
func (c *Client) GetHeatMapPoint(ctx context.Context, site, id string) (*HeatMapPoint, error) {
return c.getHeatMapPoint(ctx, site, id)
}
func (c *Client) DeleteHeatMapPoint(ctx context.Context, site, id string) error {
return c.deleteHeatMapPoint(ctx, site, id)
}
func (c *Client) CreateHeatMapPoint(ctx context.Context, site string, d *HeatMapPoint) (*HeatMapPoint, error) {
return c.createHeatMapPoint(ctx, site, d)
}
func (c *Client) UpdateHeatMapPoint(ctx context.Context, site string, d *HeatMapPoint) (*HeatMapPoint, error) {
return c.updateHeatMapPoint(ctx, site, d)
}

28
unifi/hotspot_2_conf.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListHotspot2Conf(ctx context.Context, site string) ([]Hotspot2Conf, error) {
return c.listHotspot2Conf(ctx, site)
}
func (c *Client) GetHotspot2Conf(ctx context.Context, site, id string) (*Hotspot2Conf, error) {
return c.getHotspot2Conf(ctx, site, id)
}
func (c *Client) DeleteHotspot2Conf(ctx context.Context, site, id string) error {
return c.deleteHotspot2Conf(ctx, site, id)
}
func (c *Client) CreateHotspot2Conf(ctx context.Context, site string, d *Hotspot2Conf) (*Hotspot2Conf, error) {
return c.createHotspot2Conf(ctx, site, d)
}
func (c *Client) UpdateHotspot2Conf(ctx context.Context, site string, d *Hotspot2Conf) (*Hotspot2Conf, error) {
return c.updateHotspot2Conf(ctx, site, d)
}

28
unifi/hotspot_op.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListHotspotOp(ctx context.Context, site string) ([]HotspotOp, error) {
return c.listHotspotOp(ctx, site)
}
func (c *Client) GetHotspotOp(ctx context.Context, site, id string) (*HotspotOp, error) {
return c.getHotspotOp(ctx, site, id)
}
func (c *Client) DeleteHotspotOp(ctx context.Context, site, id string) error {
return c.deleteHotspotOp(ctx, site, id)
}
func (c *Client) CreateHotspotOp(ctx context.Context, site string, d *HotspotOp) (*HotspotOp, error) {
return c.createHotspotOp(ctx, site, d)
}
func (c *Client) UpdateHotspotOp(ctx context.Context, site string, d *HotspotOp) (*HotspotOp, error) {
return c.updateHotspotOp(ctx, site, d)
}

28
unifi/hotspot_package.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListHotspotPackage(ctx context.Context, site string) ([]HotspotPackage, error) {
return c.listHotspotPackage(ctx, site)
}
func (c *Client) GetHotspotPackage(ctx context.Context, site, id string) (*HotspotPackage, error) {
return c.getHotspotPackage(ctx, site, id)
}
func (c *Client) DeleteHotspotPackage(ctx context.Context, site, id string) error {
return c.deleteHotspotPackage(ctx, site, id)
}
func (c *Client) CreateHotspotPackage(ctx context.Context, site string, d *HotspotPackage) (*HotspotPackage, error) {
return c.createHotspotPackage(ctx, site, d)
}
func (c *Client) UpdateHotspotPackage(ctx context.Context, site string, d *HotspotPackage) (*HotspotPackage, error) {
return c.updateHotspotPackage(ctx, site, d)
}

View File

@@ -86,5 +86,5 @@ func (e *booleanishString) UnmarshalJSON(b []byte) error {
*e = booleanishString(false)
return nil
}
return errors.New("Could not unmarshal JSON value.")
return errors.New("could not unmarshal JSON value")
}

28
unifi/map.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListMap(ctx context.Context, site string) ([]Map, error) {
return c.listMap(ctx, site)
}
func (c *Client) GetMap(ctx context.Context, site, id string) (*Map, error) {
return c.getMap(ctx, site, id)
}
func (c *Client) DeleteMap(ctx context.Context, site, id string) error {
return c.deleteMap(ctx, site, id)
}
func (c *Client) CreateMap(ctx context.Context, site string, d *Map) (*Map, error) {
return c.createMap(ctx, site, d)
}
func (c *Client) UpdateMap(ctx context.Context, site string, d *Map) (*Map, error) {
return c.updateMap(ctx, site, d)
}

28
unifi/media_file.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListMediaFile(ctx context.Context, site string) ([]MediaFile, error) {
return c.listMediaFile(ctx, site)
}
func (c *Client) GetMediaFile(ctx context.Context, site, id string) (*MediaFile, error) {
return c.getMediaFile(ctx, site, id)
}
func (c *Client) DeleteMediaFile(ctx context.Context, site, id string) error {
return c.deleteMediaFile(ctx, site, id)
}
func (c *Client) CreateMediaFile(ctx context.Context, site string, d *MediaFile) (*MediaFile, error) {
return c.createMediaFile(ctx, site, d)
}
func (c *Client) UpdateMediaFile(ctx context.Context, site string, d *MediaFile) (*MediaFile, error) {
return c.updateMediaFile(ctx, site, d)
}

28
unifi/schedule_task.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListScheduleTask(ctx context.Context, site string) ([]ScheduleTask, error) {
return c.listScheduleTask(ctx, site)
}
func (c *Client) GetScheduleTask(ctx context.Context, site, id string) (*ScheduleTask, error) {
return c.getScheduleTask(ctx, site, id)
}
func (c *Client) DeleteScheduleTask(ctx context.Context, site, id string) error {
return c.deleteScheduleTask(ctx, site, id)
}
func (c *Client) CreateScheduleTask(ctx context.Context, site string, d *ScheduleTask) (*ScheduleTask, error) {
return c.createScheduleTask(ctx, site, d)
}
func (c *Client) UpdateScheduleTask(ctx context.Context, site string, d *ScheduleTask) (*ScheduleTask, error) {
return c.updateScheduleTask(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingAutoSpeedtest(ctx context.Context, site string) (*SettingAutoSpeedtest, error) {
return c.getSettingAutoSpeedtest(ctx, site)
}
func (c *Client) UpdateSettingAutoSpeedtest(ctx context.Context, site string, d *SettingAutoSpeedtest) (*SettingAutoSpeedtest, error) {
return c.updateSettingAutoSpeedtest(ctx, site, d)
}

17
unifi/setting_baresip.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingBaresip(ctx context.Context, site string) (*SettingBaresip, error) {
return c.getSettingBaresip(ctx, site)
}
func (c *Client) UpdateSettingBaresip(ctx context.Context, site string, d *SettingBaresip) (*SettingBaresip, error) {
return c.updateSettingBaresip(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingBroadcast(ctx context.Context, site string) (*SettingBroadcast, error) {
return c.getSettingBroadcast(ctx, site)
}
func (c *Client) UpdateSettingBroadcast(ctx context.Context, site string, d *SettingBroadcast) (*SettingBroadcast, error) {
return c.updateSettingBroadcast(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingConnectivity(ctx context.Context, site string) (*SettingConnectivity, error) {
return c.getSettingConnectivity(ctx, site)
}
func (c *Client) UpdateSettingConnectivity(ctx context.Context, site string, d *SettingConnectivity) (*SettingConnectivity, error) {
return c.updateSettingConnectivity(ctx, site, d)
}

17
unifi/setting_country.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingCountry(ctx context.Context, site string) (*SettingCountry, error) {
return c.getSettingCountry(ctx, site)
}
func (c *Client) UpdateSettingCountry(ctx context.Context, site string, d *SettingCountry) (*SettingCountry, error) {
return c.updateSettingCountry(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingDashboard(ctx context.Context, site string) (*SettingDashboard, error) {
return c.getSettingDashboard(ctx, site)
}
func (c *Client) UpdateSettingDashboard(ctx context.Context, site string, d *SettingDashboard) (*SettingDashboard, error) {
return c.updateSettingDashboard(ctx, site, d)
}

17
unifi/setting_doh.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingDoh(ctx context.Context, site string) (*SettingDoh, error) {
return c.getSettingDoh(ctx, site)
}
func (c *Client) UpdateSettingDoh(ctx context.Context, site string, d *SettingDoh) (*SettingDoh, error) {
return c.updateSettingDoh(ctx, site, d)
}

17
unifi/setting_dpi.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingDpi(ctx context.Context, site string) (*SettingDpi, error) {
return c.getSettingDpi(ctx, site)
}
func (c *Client) UpdateSettingDpi(ctx context.Context, site string, d *SettingDpi) (*SettingDpi, error) {
return c.updateSettingDpi(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingElementAdopt(ctx context.Context, site string) (*SettingElementAdopt, error) {
return c.getSettingElementAdopt(ctx, site)
}
func (c *Client) UpdateSettingElementAdopt(ctx context.Context, site string, d *SettingElementAdopt) (*SettingElementAdopt, error) {
return c.updateSettingElementAdopt(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingEtherLighting(ctx context.Context, site string) (*SettingEtherLighting, error) {
return c.getSettingEtherLighting(ctx, site)
}
func (c *Client) UpdateSettingEtherLighting(ctx context.Context, site string, d *SettingEtherLighting) (*SettingEtherLighting, error) {
return c.updateSettingEtherLighting(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingEvaluationScore(ctx context.Context, site string) (*SettingEvaluationScore, error) {
return c.getSettingEvaluationScore(ctx, site)
}
func (c *Client) UpdateSettingEvaluationScore(ctx context.Context, site string, d *SettingEvaluationScore) (*SettingEvaluationScore, error) {
return c.updateSettingEvaluationScore(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingGlobalAp(ctx context.Context, site string) (*SettingGlobalAp, error) {
return c.getSettingGlobalAp(ctx, site)
}
func (c *Client) UpdateSettingGlobalAp(ctx context.Context, site string, d *SettingGlobalAp) (*SettingGlobalAp, error) {
return c.updateSettingGlobalAp(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingGlobalNat(ctx context.Context, site string) (*SettingGlobalNat, error) {
return c.getSettingGlobalNat(ctx, site)
}
func (c *Client) UpdateSettingGlobalNat(ctx context.Context, site string, d *SettingGlobalNat) (*SettingGlobalNat, error) {
return c.updateSettingGlobalNat(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingGlobalSwitch(ctx context.Context, site string) (*SettingGlobalSwitch, error) {
return c.getSettingGlobalSwitch(ctx, site)
}
func (c *Client) UpdateSettingGlobalSwitch(ctx context.Context, site string, d *SettingGlobalSwitch) (*SettingGlobalSwitch, error) {
return c.updateSettingGlobalSwitch(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingGuestAccess(ctx context.Context, site string) (*SettingGuestAccess, error) {
return c.getSettingGuestAccess(ctx, site)
}
func (c *Client) UpdateSettingGuestAccess(ctx context.Context, site string, d *SettingGuestAccess) (*SettingGuestAccess, error) {
return c.updateSettingGuestAccess(ctx, site, d)
}

17
unifi/setting_ips.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingIps(ctx context.Context, site string) (*SettingIps, error) {
return c.getSettingIps(ctx, site)
}
func (c *Client) UpdateSettingIps(ctx context.Context, site string, d *SettingIps) (*SettingIps, error) {
return c.updateSettingIps(ctx, site, d)
}

17
unifi/setting_lcm.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingLcm(ctx context.Context, site string) (*SettingLcm, error) {
return c.getSettingLcm(ctx, site)
}
func (c *Client) UpdateSettingLcm(ctx context.Context, site string, d *SettingLcm) (*SettingLcm, error) {
return c.updateSettingLcm(ctx, site, d)
}

17
unifi/setting_locale.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingLocale(ctx context.Context, site string) (*SettingLocale, error) {
return c.getSettingLocale(ctx, site)
}
func (c *Client) UpdateSettingLocale(ctx context.Context, site string, d *SettingLocale) (*SettingLocale, error) {
return c.updateSettingLocale(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingMagicSiteToSiteVpn(ctx context.Context, site string) (*SettingMagicSiteToSiteVpn, error) {
return c.getSettingMagicSiteToSiteVpn(ctx, site)
}
func (c *Client) UpdateSettingMagicSiteToSiteVpn(ctx context.Context, site string, d *SettingMagicSiteToSiteVpn) (*SettingMagicSiteToSiteVpn, error) {
return c.updateSettingMagicSiteToSiteVpn(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingNetworkOptimization(ctx context.Context, site string) (*SettingNetworkOptimization, error) {
return c.getSettingNetworkOptimization(ctx, site)
}
func (c *Client) UpdateSettingNetworkOptimization(ctx context.Context, site string, d *SettingNetworkOptimization) (*SettingNetworkOptimization, error) {
return c.updateSettingNetworkOptimization(ctx, site, d)
}

17
unifi/setting_ntp.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingNtp(ctx context.Context, site string) (*SettingNtp, error) {
return c.getSettingNtp(ctx, site)
}
func (c *Client) UpdateSettingNtp(ctx context.Context, site string, d *SettingNtp) (*SettingNtp, error) {
return c.updateSettingNtp(ctx, site, d)
}

17
unifi/setting_porta.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingPorta(ctx context.Context, site string) (*SettingPorta, error) {
return c.getSettingPorta(ctx, site)
}
func (c *Client) UpdateSettingPorta(ctx context.Context, site string, d *SettingPorta) (*SettingPorta, error) {
return c.updateSettingPorta(ctx, site, d)
}

17
unifi/setting_radio_ai.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingRadioAi(ctx context.Context, site string) (*SettingRadioAi, error) {
return c.getSettingRadioAi(ctx, site)
}
func (c *Client) UpdateSettingRadioAi(ctx context.Context, site string, d *SettingRadioAi) (*SettingRadioAi, error) {
return c.updateSettingRadioAi(ctx, site, d)
}

17
unifi/setting_rsyslogd.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingRsyslogd(ctx context.Context, site string) (*SettingRsyslogd, error) {
return c.getSettingRsyslogd(ctx, site)
}
func (c *Client) UpdateSettingRsyslogd(ctx context.Context, site string, d *SettingRsyslogd) (*SettingRsyslogd, error) {
return c.updateSettingRsyslogd(ctx, site, d)
}

17
unifi/setting_snmp.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingSnmp(ctx context.Context, site string) (*SettingSnmp, error) {
return c.getSettingSnmp(ctx, site)
}
func (c *Client) UpdateSettingSnmp(ctx context.Context, site string, d *SettingSnmp) (*SettingSnmp, error) {
return c.updateSettingSnmp(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingSslInspection(ctx context.Context, site string) (*SettingSslInspection, error) {
return c.getSettingSslInspection(ctx, site)
}
func (c *Client) UpdateSettingSslInspection(ctx context.Context, site string, d *SettingSslInspection) (*SettingSslInspection, error) {
return c.updateSettingSslInspection(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingSuperCloudaccess(ctx context.Context, site string) (*SettingSuperCloudaccess, error) {
return c.getSettingSuperCloudaccess(ctx, site)
}
func (c *Client) UpdateSettingSuperCloudaccess(ctx context.Context, site string, d *SettingSuperCloudaccess) (*SettingSuperCloudaccess, error) {
return c.updateSettingSuperCloudaccess(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingSuperEvents(ctx context.Context, site string) (*SettingSuperEvents, error) {
return c.getSettingSuperEvents(ctx, site)
}
func (c *Client) UpdateSettingSuperEvents(ctx context.Context, site string, d *SettingSuperEvents) (*SettingSuperEvents, error) {
return c.updateSettingSuperEvents(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingSuperFwupdate(ctx context.Context, site string) (*SettingSuperFwupdate, error) {
return c.getSettingSuperFwupdate(ctx, site)
}
func (c *Client) UpdateSettingSuperFwupdate(ctx context.Context, site string, d *SettingSuperFwupdate) (*SettingSuperFwupdate, error) {
return c.updateSettingSuperFwupdate(ctx, site, d)
}

View File

@@ -0,0 +1,16 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingSuperIdentity(ctx context.Context, site string) (*SettingSuperIdentity, error) {
return c.getSettingSuperIdentity(ctx, site)
}
func (c *Client) UpdateSettingSuperIdentity(ctx context.Context, site string, d *SettingSuperIdentity) (*SettingSuperIdentity, error) {
return c.updateSettingSuperIdentity(ctx, site, d)
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingSuperMail(ctx context.Context, site string) (*SettingSuperMail, error) {
return c.getSettingSuperMail(ctx, site)
}
func (c *Client) UpdateSettingSuperMail(ctx context.Context, site string, d *SettingSuperMail) (*SettingSuperMail, error) {
return c.updateSettingSuperMail(ctx, site, d)
}

View File

@@ -0,0 +1,15 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingSuperMgmt(ctx context.Context, site string) (*SettingSuperMgmt, error) {
return c.getSettingSuperMgmt(ctx, site)
}
func (c *Client) UpdateSettingSuperMgmt(ctx context.Context, site string, d *SettingSuperMgmt) (*SettingSuperMgmt, error) {
return c.updateSettingSuperMgmt(ctx, site, d)
}

View File

@@ -0,0 +1,16 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingSuperSdn(ctx context.Context, site string) (*SettingSuperSdn, error) {
return c.getSettingSuperSdn(ctx, site)
}
func (c *Client) UpdateSettingSuperSdn(ctx context.Context, site string, d *SettingSuperSdn) (*SettingSuperSdn, error) {
return c.updateSettingSuperSdn(ctx, site, d)
}

View File

@@ -0,0 +1,16 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingSuperSmtp(ctx context.Context, site string) (*SettingSuperSmtp, error) {
return c.getSettingSuperSmtp(ctx, site)
}
func (c *Client) UpdateSettingSuperSmtp(ctx context.Context, site string, d *SettingSuperSmtp) (*SettingSuperSmtp, error) {
return c.updateSettingSuperSmtp(ctx, site, d)
}

16
unifi/setting_teleport.go Normal file
View File

@@ -0,0 +1,16 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingTeleport(ctx context.Context, site string) (*SettingTeleport, error) {
return c.getSettingTeleport(ctx, site)
}
func (c *Client) UpdateSettingTeleport(ctx context.Context, site string, d *SettingTeleport) (*SettingTeleport, error) {
return c.updateSettingTeleport(ctx, site, d)
}

17
unifi/setting_usw.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingUsw(ctx context.Context, site string) (*SettingUsw, error) {
return c.getSettingUsw(ctx, site)
}
func (c *Client) UpdateSettingUsw(ctx context.Context, site string, d *SettingUsw) (*SettingUsw, error) {
return c.updateSettingUsw(ctx, site, d)
}

28
unifi/spatial_record.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListSpatialRecord(ctx context.Context, site string) ([]SpatialRecord, error) {
return c.listSpatialRecord(ctx, site)
}
func (c *Client) GetSpatialRecord(ctx context.Context, site, id string) (*SpatialRecord, error) {
return c.getSpatialRecord(ctx, site, id)
}
func (c *Client) DeleteSpatialRecord(ctx context.Context, site, id string) error {
return c.deleteSpatialRecord(ctx, site, id)
}
func (c *Client) CreateSpatialRecord(ctx context.Context, site string, d *SpatialRecord) (*SpatialRecord, error) {
return c.createSpatialRecord(ctx, site, d)
}
func (c *Client) UpdateSpatialRecord(ctx context.Context, site string, d *SpatialRecord) (*SpatialRecord, error) {
return c.updateSpatialRecord(ctx, site, d)
}

28
unifi/tag.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListTag(ctx context.Context, site string) ([]Tag, error) {
return c.listTag(ctx, site)
}
func (c *Client) GetTag(ctx context.Context, site, id string) (*Tag, error) {
return c.getTag(ctx, site, id)
}
func (c *Client) DeleteTag(ctx context.Context, site, id string) error {
return c.deleteTag(ctx, site, id)
}
func (c *Client) CreateTag(ctx context.Context, site string, d *Tag) (*Tag, error) {
return c.createTag(ctx, site, d)
}
func (c *Client) UpdateTag(ctx context.Context, site string, d *Tag) (*Tag, error) {
return c.updateTag(ctx, site, d)
}

View File

@@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/cookiejar"
"net/url"
@@ -114,7 +113,7 @@ func (c *Client) setAPIUrlStyle(ctx context.Context) error {
return err
}
defer resp.Body.Close()
_, _ = io.Copy(ioutil.Discard, resp.Body)
_, _ = io.Copy(io.Discard, resp.Body)
if resp.StatusCode == http.StatusOK {
// the new API returns a 200 for a / request

28
unifi/virtual_device.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) ListVirtualDevice(ctx context.Context, site string) ([]VirtualDevice, error) {
return c.listVirtualDevice(ctx, site)
}
func (c *Client) GetVirtualDevice(ctx context.Context, site, id string) (*VirtualDevice, error) {
return c.getVirtualDevice(ctx, site, id)
}
func (c *Client) DeleteVirtualDevice(ctx context.Context, site, id string) error {
return c.deleteVirtualDevice(ctx, site, id)
}
func (c *Client) CreateVirtualDevice(ctx context.Context, site string, d *VirtualDevice) (*VirtualDevice, error) {
return c.createVirtualDevice(ctx, site, d)
}
func (c *Client) UpdateVirtualDevice(ctx context.Context, site string, d *VirtualDevice) (*VirtualDevice, error) {
return c.updateVirtualDevice(ctx, site, d)
}