Skip to content

Commit 5bfe78d

Browse files
tonysurflyclaude
andcommitted
Rename roundrobin-failover mode to roundRobinFailover
Constellix v4 API now returns the mode as "roundRobinFailover" (camelCase) instead of "roundrobin-failover". Update parser and tests to match. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 075d21f commit 5bfe78d

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

cmd/dns_domain_record_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func TestExpectedDNSRecord_RRFailover_UnmarshalYAML(t *testing.T) {
279279
name: abc
280280
type: A
281281
ttl: 60
282-
mode: roundrobin-failover
282+
mode: roundRobinFailover
283283
region: default
284284
enabled: true
285285
value:
@@ -302,8 +302,8 @@ value:
302302
t.Errorf("expected %q, got %q", "abc", obj.Name)
303303
return
304304
}
305-
if obj.Mode != "roundrobin-failover" {
306-
t.Errorf("expected %q, got %q", "roundrobin-failover", obj.Mode)
305+
if obj.Mode != "roundRobinFailover" {
306+
t.Errorf("expected %q, got %q", "roundRobinFailover", obj.Mode)
307307
return
308308
}
309309
expected := []*DNSFailoverItemValue{
@@ -354,7 +354,7 @@ value:
354354
}
355355

356356
func TestExpectedDNSRecord_RRFailover_UnmarshalJSON(t *testing.T) {
357-
data := `{"id":31847262,"name":"abc","type":"A","ttl":60,"mode":"roundrobin-failover","region":"default","ipfilter":null,"ipfilterDrop":false,"geoFailover":false,"geoproximity":null,"enabled":true,"value":[{"value":"159.69.18.28","order":1,"sonarCheckId":84874,"enabled":true,"active":false,"failed":true,"status":"DOWN"},{"value":"1.1.1.1","order":2,"sonarCheckId":null,"enabled":true,"active":false,"failed":false,"status":"N\/A"}]}`
357+
data := `{"id":31847262,"name":"abc","type":"A","ttl":60,"mode":"roundRobinFailover","region":"default","ipfilter":null,"ipfilterDrop":false,"geoFailover":false,"geoproximity":null,"enabled":true,"value":[{"value":"159.69.18.28","order":1,"sonarCheckId":84874,"enabled":true,"active":false,"failed":true,"status":"DOWN"},{"value":"1.1.1.1","order":2,"sonarCheckId":null,"enabled":true,"active":false,"failed":false,"status":"N\/A"}]}`
358358
var obj ExpectedDNSRecord
359359
err := json.Unmarshal([]byte(data), &obj)
360360
if err != nil {
@@ -365,8 +365,8 @@ func TestExpectedDNSRecord_RRFailover_UnmarshalJSON(t *testing.T) {
365365
t.Errorf("expected %q, got %q", "abc", obj.Name)
366366
return
367367
}
368-
if obj.Mode != "roundrobin-failover" {
369-
t.Errorf("expected %q, got %q", "failover", obj.Mode)
368+
if obj.Mode != "roundRobinFailover" {
369+
t.Errorf("expected %q, got %q", "roundRobinFailover", obj.Mode)
370370
return
371371
}
372372
expected := []*DNSFailoverItemValue{

cmd/dns_domain_record_value.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,19 @@ func populateDNSRecordValue(record interface{}) error {
107107
}
108108
valueObj.Values = values
109109
s.Value = &valueObj
110-
case "roundrobin-failover":
110+
case "roundRobinFailover":
111111
if s.Type == "CNAME" || s.Type == "ANAME" {
112-
return fmt.Errorf("roundrobin-failover is not supported for CNAME records")
112+
return fmt.Errorf("roundRobinFailover is not supported for CNAME records")
113113
}
114114
m, ok := s.Value.([]interface{})
115115
if !ok {
116-
return fmt.Errorf("unable to parse value for roundrobin-failover mode, expected an array")
116+
return fmt.Errorf("unable to parse value for roundRobinFailover mode, expected an array")
117117
}
118118
valueObj := make([]*DNSFailoverItemValue, 0)
119119
for _, el := range m {
120120
elMap, ok := el.(map[string]interface{})
121121
if !ok {
122-
return fmt.Errorf("unable to parse value for roundrobin-failover mode, expected an map")
122+
return fmt.Errorf("unable to parse value for roundRobinFailover mode, expected an map")
123123
}
124124
sonarCheckID, sonarCheckHost, err := getSonarCheckID(elMap["sonarCheckId"])
125125
if err != nil {

0 commit comments

Comments
 (0)