Skip to content

Commit

Permalink
Merge branch 'kashalls:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmy-ungerman authored May 24, 2024
2 parents e6d47d0 + 44d077a commit f9c065a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [kashalls]
15 changes: 9 additions & 6 deletions dnsprovider/dnsprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"net/http/cookiejar"
"strings"

log "github.com/sirupsen/logrus"
"sigs.k8s.io/external-dns/endpoint"
"sigs.k8s.io/external-dns/plan"
"sigs.k8s.io/external-dns/provider"
Expand Down Expand Up @@ -219,22 +218,17 @@ func (c *Client) CreateRecord(record DNSRecord) (*DNSRecord, error) {
return nil, err
}

log.Debugf("json marshal: %v", record)

resp, err := c.ShipData(UnifiDNSRecords, body)
if err != nil {
return nil, err
}

log.Debugf("json marshal 2: %v", resp)

var newRecord DNSRecord
err = json.Unmarshal(resp, &newRecord)
if err != nil {
return nil, err
}

log.Debugf("json marshal 3: %v", newRecord)
return &newRecord, nil
}

Expand Down Expand Up @@ -291,6 +285,10 @@ func (p *DNSProvider) Records(ctx context.Context) ([]*endpoint.Endpoint, error)
return nil, err
}

jsonData, _ := json.Marshal(records)
jsonString := string(jsonData)
fmt.Println(jsonString)

var endpoints []*endpoint.Endpoint
for _, record := range records {
if record.RecordType == "TXT" {
Expand All @@ -309,6 +307,11 @@ func (p *DNSProvider) Records(ctx context.Context) ([]*endpoint.Endpoint, error)

// ApplyChanges applies a given set of changes in the DNS provider.
func (p *DNSProvider) ApplyChanges(ctx context.Context, changes *plan.Changes) error {

jsonData, _ := json.Marshal(changes)
jsonString := string(jsonData)
fmt.Println(jsonString)

for _, ep := range changes.Create {
record := DNSRecord{
Key: ep.DNSName,
Expand Down

0 comments on commit f9c065a

Please sign in to comment.