Files
go-unifi/unifi/dns_record.go
Mateusz Filipowicz aa188a6faa feat: add API v2 support by adding APGroup and DNSRecord resource handling with generated code (#23)
* feat: add API v2 support by adding APGroup and DNSRecord resource handling with generated code

* fix tests
2025-02-17 15:39:54 +01:00

37 lines
931 B
Go

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) {
// client-side filtering is needed, because of lack of endpoint
records, err := c.listDNSRecord(ctx, site)
if err != nil {
return nil, err
}
for _, record := range records {
if record.ID == id {
return &record, nil
}
}
return nil, ErrNotFound
}
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)
}