Skip to content

Commit 0db7a6c

Browse files
committed
Update for alert center GA.
- Use alerting/v1 in REST calls. - Update changelog and client version. - Minor fix to example to create secondary zone correctly.
1 parent c522965 commit 0db7a6c

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 2.13.0 (Oct 28th, 2024)
1+
## 2.13.0 (Dec 5th, 2024)
22

33
FEATURES:
44

mockns1/alert.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type mockAlertListResponse struct {
1515
TotalResults *int64 `json:"total_results,omitempty"`
1616
}
1717

18-
const alertPath = "../alerting/v1beta1/alerts"
18+
const alertPath = "../alerting/v1/alerts"
1919

2020
// AddAlertListTestCase sets up a test case for the api.Client.Alert.List()
2121
// function

rest/_examples/alerts.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ func init() {
3131

3232
func prettyPrint(header string, v interface{}) {
3333
fmt.Println(header)
34-
fmt.Printf("%#v \n", v)
3534
b, _ := json.MarshalIndent(v, "", " ")
3635
fmt.Println(string(b))
3736
}
@@ -66,6 +65,11 @@ func main() {
6665

6766
z := dns.NewZone(domain)
6867
z.NxTTL = 3600
68+
z.Secondary = &dns.ZoneSecondary{
69+
Enabled: true,
70+
PrimaryIP: "127.0.0.1",
71+
PrimaryPort: 67,
72+
}
6973
_, err = client.Zones.Create(z)
7074
if err != nil {
7175
// Ignore if zone already exists
@@ -75,10 +79,10 @@ func main() {
7579
log.Println("Zone already exists, continuing...")
7680
}
7781
}
78-
7982
prettyPrint("Zone:", z)
80-
fmt.Printf("Creating alert...\n")
83+
8184
alert := alerting.NewZoneAlert("myalerttest.com - transfer failed", "transfer_failed", []string{webhookList.ID}, []string{domain})
85+
prettyPrint("Creating alert: ", alert)
8286
_, err = client.Alerts.Create(alert)
8387
if err != nil {
8488
if err == api.ErrAlertExists {

rest/alert.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type AlertsService service
1313

1414
// The base for the alerting api relative to /v1
1515
// client.NewRequest will call ResolveReference and remove /v1/../
16-
const alertingRelativeBase = "../alerting/v1beta1"
16+
const alertingRelativeBase = "../alerting/v1"
1717

1818
type alertListResponse struct {
1919
Limit *int64 `json:"limit,omitempty"`

rest/alert_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestAlert(t *testing.T) {
4545
defer mock.ClearTestCases()
4646

4747
linkHeader := http.Header{}
48-
linkHeader.Set("Link", `</alerting/v1beta1/alerts?next=`+*alertList[1].Name+`>; rel="next"`)
48+
linkHeader.Set("Link", `</alerting/v1/alerts?next=`+*alertList[1].Name+`>; rel="next"`)
4949
require.Nil(t, mock.AddAlertListTestCase("", nil, linkHeader, alertList[0:1]))
5050
require.Nil(t, mock.AddAlertListTestCase("next="+*alertList[1].Name, nil, nil, alertList[2:3]))
5151

rest/client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
)
1414

1515
const (
16-
clientVersion = "2.12.2"
16+
clientVersion = "2.13.0"
1717

18-
defaultBase = "http://localhost:80"
18+
defaultBase = "https://api.nsone.net"
1919
defaultEndpoint = defaultBase + "/v1/"
2020
defaultShouldFollowPagination = true
2121
defaultUserAgent = "go-ns1/" + clientVersion

0 commit comments

Comments
 (0)